简体   繁体   English

如何检查aspxgridview是否从另一个记录生成?

[英]How to check in aspxgridview if a record is generated from another?

I have a grid, that contains 6 fields same as its table, ie transaction table contains 6 fields. 我有一个网格,其中包含与其表相同的6个字段,即事务表包含6个字段。 This grid contains: 该网格包含:

Transactionid
Name
Date
Transactiontype
amount
action 

Transaction type can be sale, if transaction is sale,authorize if its authorize, refund if its refund, postauthorize if its capture and void if transaction is void. 交易类型可以为销售,如果交易为销售,则授权为授权,退款为退款,捕获为后授权,交易无效为无效。 These refund,void and capture resides in action field of the grid, if transaction type is sale then you can do a refund, so in the corresponding action field you'll get refund action.Now after you do a refund or capture or void another record is inserted into database with a new transaction id. 这些退款,无效和捕获位于网格的操作字段中,如果交易类型为销售,那么您可以进行退款,因此在相应的操作字段中,您将获得退款操作。现在,在执行退款或捕获或使另一个无效之后记录将以新的事务ID插入数据库。

Now my question is when im checking for this newly inserted record i can not get this refund transaction is done from which sale transaction. 现在我的问题是,当我检查此新插入的记录时,我无法从哪个销售交易中获得此退款交易。 If someone do a partial refund, then i have to calculate how much amount is remaining. 如果有人做了部分退款,那么我必须计算出还有多少钱。 I cannot add anymore fields to my table, is it possible that way ? 我无法再将任何字段添加到表中,这可能吗?

Transaction ID       Name   Trans Date  Type       Amount          Action
qwee1321312          aa bb  03/21/2012  Sale       $14.00      Refund  
adsd231233           aa bb  03/26/2012  Sale       $50.00      Refund  
12312dda             aa bb  03/26/2012  Authorize  $100.00    Capture   Void
                     aa bb  03/26/2012   Void      $100.00         

Action field is to perform refund,capture or void transction. 操作字段用于执行退款,捕获或无效交易。 Whenever you do void or refund or capture a new row created.Now how to get and remove action field of 3rd row from where 4th row is created. 每当您作废,退款或捕获新创建的行时,现在如何在创建第四行的地方获取和删除第三行的操作字段。 Im checking on htmlrowcreated event 我正在检查htmlrowcreated事件

 if (type == "Sale")
                {
                    //Checks Amount for sale transaction
                    amount = Convert.ToDecimal(CheckTransaction(Convert.ToInt64(tid), (int)Enums.TransactionType.Refund));
                    if (amount > 0)
                    {
                        lnkaction.Text = "Refund";
                        lnkaction.Attributes.Add("onclick", "javascript:return RefundPopup('" + tid + "','" + Refund1.lblClientID + "','" + amount + "','Refund Sale');");
                    }
                }
                else if (type == "Authorize")
                {
                    //Checks Amount for authorization transaction
                    amount = Convert.ToDecimal(CheckTransaction(Convert.ToInt64(tid), (int)Enums.TransactionType.PostAuthorize));
                    if (amount > 0)
                    {
                        lnkaction.Text = "Capture";
                        lnkaction.Attributes.Add("onClick", "javascript:return RefundPopup('" + tid + "','" + Refund1.lblClientID + "','" + amount + "','Capture Sale');");
                        lnkvoid.Text = "Void";
                    }
                }

But its not working, after i do a refund or void. 但是在我退款或作废后,它不起作用。

I'm still not sure I understand what you are trying to achieve but.... 我仍然不确定我是否理解您要实现的目标,但是...

What I think you are trying to do. 我认为您正在尝试做。

Your example has 3 rows? 您的示例有3行?

The user clicks "Void" on row 3? 用户单击第3行上的“无效”?

This then creates the 4th row? 然后创建第四行?

You now wish to remove the "Capture" and "Void" buttons from row 3? 现在,您要从第3行中删除“捕获”和“无效”按钮吗?

You should mark the row as refunded in some way eg Set the type to "Refunded" or "Voided" and then hide the buttons for this type using their Visible property 您应该以某种方式将行标记为已退款,例如,将类型设置为“已退款”或“无效”,然后使用其“可见”属性隐藏此类型的按钮

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM