Ejemplo n.º 1
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            if (inputCheck())
            {
                DataTable receiptApplyTable = getInput();

                //PaymentApplyProcess pap = Session["PaymentApplyProcess"] as PaymentApplyProcess;

                //pap.MyDst.Tables.Add(payApplyTable);
                //pap.Add();

                System.Nullable <int>   mainContractId    = int.Parse(receiptApplyTable.Rows[0]["mainContractId"].ToString());
                System.Nullable <float> custMaxReceipt    = float.Parse(receiptApplyTable.Rows[0]["custMaxReceipt"].ToString());
                System.Nullable <float> selfToReceipt     = float.Parse(receiptApplyTable.Rows[0]["receiptPercent"].ToString());
                System.Nullable <float> hasReceiptPercent = float.Parse(receiptApplyTable.Rows[0]["selfHasReceipt"].ToString());
                string receiptExplication    = receiptApplyTable.Rows[0]["receiptExplication"].ToString();
                System.Nullable <int> intRef = 0;

                string num = float.Parse(receiptApplyTable.Rows[0]["receiptPercent"].ToString()).ToString("p");

                Xm_db xmDataCont = Xm_db.GetInstance();

                try
                {
                    xmDataCont.Tbl_receiptApply_Insert(mainContractId, custMaxReceipt, selfToReceipt, hasReceiptPercent, receiptExplication, ref intRef);

                    xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);

                    applyOk(num, xmDataCont);
                }
                catch (System.Data.Linq.ChangeConflictException cce)
                {
                    string strEx = cce.Message;
                    foreach (System.Data.Linq.ObjectChangeConflict occ in xmDataCont.ChangeConflicts)
                    {
                        occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges);
                    }

                    xmDataCont.Tbl_receiptApply_Insert(mainContractId, custMaxReceipt, selfToReceipt, hasReceiptPercent, receiptExplication, ref intRef);

                    xmDataCont.SubmitChanges();

                    applyOk(num, xmDataCont);
                }
            }
        }