private void button2_Click(object sender, EventArgs e) { string connection_string = Utils.getConnectionstr(); LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string); var paymentdetail = (from tbl_kacontractsdetailpayment in dc.tbl_kacontractsdetailpayments where tbl_kacontractsdetailpayment.ContractNo.Equals(ContractNo) && tbl_kacontractsdetailpayment.PayControl.Equals(Programe) && tbl_kacontractsdetailpayment.PayID == PayID && tbl_kacontractsdetailpayment.SubID == SubID && tbl_kacontractsdetailpayment.BatchNo == Batchno select tbl_kacontractsdetailpayment).FirstOrDefault(); if (paymentdetail != null) { paymentdetail.PayControl = "REJ"; paymentdetail.PaidAmt = 0; // paymentdetail.PaidRequestAmt = 0; if (txtpaidnote.Text != null) { if (txtpaidnote.Text.ToString().Trim() != "") { paymentdetail.Remark = txtpaidnote.Text.ToString(); } } //// txtpaidnote //if (txtpaidnote.Text != null) //{ // if (txtpaidnote.Text.Trim() != "") // { // // txtpaidnote2 // paymentdetail.Description = txtpaidnote.Text.ToString(); // } //} if (txtpaidnote2.Text != null) { if (txtpaidnote2.Text.Trim() != "") { // txtpaidnote2 paymentdetail.PaidNote = txtpaidnote2.Text.ToString(); } } if (txtPaydoc.Text != null) { if (txtPaydoc.Text.ToString().Trim() != "") { paymentdetail.PaymentDoc = txtPaydoc.Text.ToString(); } } // paymentdetail.PaidOn = pickdatedoneon.Value; // paymentdetail.DoneOn = DateTime.Today; paymentdetail.UPDDAT = DateTime.Today; paymentdetail.UPDUSR = Utils.getusername(); dc.SubmitChanges(); #region dataGridView7 detail pay ment var dataGridProgramdetailrs7 = from tbl_kacontractsdetailpayment in dc.tbl_kacontractsdetailpayments where tbl_kacontractsdetailpayment.ContractNo.Equals(ContractNo)// && tbl_kacontractsdetailpayment.BatchNo == Batchno select new { Programe = tbl_kacontractsdetailpayment.PayType.Trim(), PayControlID = tbl_kacontractsdetailpayment.PayControl.Trim(), Description = tbl_kacontractsdetailpayment.Remark.Trim(), Paid_Amount = tbl_kacontractsdetailpayment.PaidAmt, // PaidNote = tbl_kacontractsdetailpayment.PaidNote, PaymentDoc = tbl_kacontractsdetailpayment.PaymentDoc, tbl_kacontractsdetailpayment.PaidRequestAmt, tbl_kacontractsdetailpayment.PrintChk, tbl_kacontractsdetailpayment.Reprint, tbl_kacontractsdetailpayment.PrintDate, // Remarks = tbl_kacontractsdetailpayment.Remark.Trim(), tbl_kacontractsdetailpayment.BatchNo, tbl_kacontractsdetailpayment.CRDDAT, tbl_kacontractsdetailpayment.CRDUSR, tbl_kacontractsdetailpayment.DoneOn, Paid_Note = tbl_kacontractsdetailpayment.PaidNote, tbl_kacontractsdetailpayment.UPDDAT, tbl_kacontractsdetailpayment.UPDUSR, PayID = tbl_kacontractsdetailpayment.PayID, SubID = tbl_kacontractsdetailpayment.SubID, }; Contractview.loadpaymentstausgridview(dataGridProgramdetailrs7); // Contractview.loadpaymentstausgridview(dataGridProgramdetailrs7); Contractview.loadtotaldContractView(ContractNo); #endregion this.Close(); } }
private void button4_Click(object sender, EventArgs e) { string contractno = lbcontractno.Text; string connection_string = Utils.getConnectionstr(); //if (Utils.IsValidnumber(lbBactchdoc.Text) == false) //{ // MessageBox.Show("Please check Batchno doc. " + lbBactchdoc.Text, "Thông báo !", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; //} int BatchNo = int.Parse(lbBactchdoc.Text); LinqtoSQLDataContext dc = new LinqtoSQLDataContext(connection_string); var rsprint = from tbl_kacontractsdetailpayment in dc.tbl_kacontractsdetailpayments where tbl_kacontractsdetailpayment.BatchNo == BatchNo select tbl_kacontractsdetailpayment; if (rsprint.Count() > 0) { foreach (var item in rsprint) { item.PrintChk = false; item.Reprint = true; dc.SubmitChanges(); } } #region dataGridView7 detail pay ment var dataGridProgramdetailrs7 = from tbl_kacontractsdetailpayment in dc.tbl_kacontractsdetailpayments where tbl_kacontractsdetailpayment.ContractNo == contractno && tbl_kacontractsdetailpayment.BatchNo == BatchNo select new { Programe = tbl_kacontractsdetailpayment.PayType.Trim(), PayControlID = tbl_kacontractsdetailpayment.PayControl.Trim(), Description = tbl_kacontractsdetailpayment.Remark.Trim(), Paid_Amount = tbl_kacontractsdetailpayment.PaidAmt, // PaidNote = tbl_kacontractsdetailpayment.PaidNote, PaymentDoc = tbl_kacontractsdetailpayment.PaymentDoc, tbl_kacontractsdetailpayment.PaidRequestAmt, tbl_kacontractsdetailpayment.PrintChk, tbl_kacontractsdetailpayment.Reprint, tbl_kacontractsdetailpayment.PrintDate, // Remarks = tbl_kacontractsdetailpayment.Remark.Trim(), tbl_kacontractsdetailpayment.BatchNo, tbl_kacontractsdetailpayment.CRDDAT, tbl_kacontractsdetailpayment.CRDUSR, tbl_kacontractsdetailpayment.DoneOn, Paid_Note = tbl_kacontractsdetailpayment.PaidNote, // Paid_Note = tbl_kacontractsdetailpayment.PaidNote, tbl_kacontractsdetailpayment.UPDDAT, tbl_kacontractsdetailpayment.UPDUSR, PayID = tbl_kacontractsdetailpayment.PayID, SubID = tbl_kacontractsdetailpayment.SubID, }; Contractview.loadpaymentstausgridview(dataGridProgramdetailrs7); #endregion this.Close(); }