示例#1
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            if (inputCheck())
            {
                DataTable payApplyTable = getInput();

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

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

                System.Nullable <int>   subContractId = int.Parse(payApplyTable.Rows[0]["subContractId"].ToString());
                System.Nullable <float> custMaxPay    = float.Parse(payApplyTable.Rows[0]["custMaxPay"].ToString());
                System.Nullable <float> selfToPay     = float.Parse(payApplyTable.Rows[0]["payPercent"].ToString());
                System.Nullable <float> hasPayPercent = float.Parse(payApplyTable.Rows[0]["selfHasPay"].ToString());
                string paymentExplication             = payApplyTable.Rows[0]["paymentExplication"].ToString();
                System.Nullable <int> intRef          = 0;

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

                Xm_db xmDataCont = Xm_db.GetInstance();

                try
                {
                    xmDataCont.Tbl_paymentApply_Insert(subContractId, custMaxPay, selfToPay, hasPayPercent, paymentExplication, 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_paymentApply_Insert(subContractId, custMaxPay, selfToPay, hasPayPercent, paymentExplication, ref intRef);

                    xmDataCont.SubmitChanges();

                    applyOk(num, xmDataCont);
                }
            }
        }