public void AddNewIPP(string strBankCode, int nMonths, string strCreditCardNo, string strMerchantNo) { TblIPP sqlIPP = new TblIPP(); DataTable table = sqlIPP.FillSchema("Select * from tblIPP"); DataRow r = table.NewRow(); r["StrMembershipID"] = StrMembershipID; r["DtDate"] = DateTime.Today.Date; r["StrBranchCode"] = StrBranchCode; r["StrBankCode"] = strBankCode; r["NMonths"] = nMonths; r["strCreditCardNo"] = strCreditCardNo; r["strMerchantNo"] = strMerchantNo; r["nIPPStatus"] = 3; table.Rows.Add(r); sqlIPP.SaveData(table); }
private void DeleteUselessIPP(ACMSDAL.ConnectionProvider connProvider, ACMSLogic.POS pos) { DataRow[] rowListThatHaveIPP = pos.ReceiptPaymentTable.Select("nIPPID is not null", "", DataViewRowState.CurrentRows); if (rowListThatHaveIPP.Length > 0) { TblIPP sqlIPP = new TblIPP(); sqlIPP.MainConnectionProvider = connProvider; DataTable table = sqlIPP.GetIPP(pos.StrMembershipID, pos.StrBranchCode); foreach (DataRow r in rowListThatHaveIPP) { int nIPPID = ACMS.Convert.ToInt32(r["nIPPID"]); DataRow[] rowToUpdate = table.Select("nIPPID = " + nIPPID.ToString()); if (rowToUpdate.Length > 0) { rowToUpdate[0]["nIPPStatus"] = 0; } } DataRow[] rowListToDelete = table.Select("nIPPStatus = 3", "", DataViewRowState.CurrentRows); foreach (DataRow deleteRow in rowListToDelete) { deleteRow.Delete(); } sqlIPP.SaveData(table); } }