public frmIntroduceFriend(string aMembershipID, int aEmployeeID, MemberRecord aMemberRecord, string aTerminalBranchCode) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // TblRewards rewards = new TblRewards(); DataTable rewardsTable = rewards.SelectnTypeID(0); new XtraUtils.LookupEditBuilder.LoyalPointsLookupEditBuilder(rewardsTable, lkpEdtLoyalPoint.Properties); TblReceiptFreebie Freebie = new TblReceiptFreebie(); DataTable FreebieTable = Freebie.SelectFriendFreebie(); new XtraUtils.LookupEditBuilder.FriendPromotionLookupEditBuilder(FreebieTable, lkFreebie.Properties); //0506 TblReceiptFreebie Freebie1 = new TblReceiptFreebie(); DataTable FreebieTable1 = Freebie.SelectFriendFreebie_new(); new XtraUtils.LookupEditBuilder.FriendPromotionLookupEditBuilder(FreebieTable1, lkTreatment.Properties); strMembershipID = aMembershipID; strTerminalBranchCode = aTerminalBranchCode; employeeID = aEmployeeID; myMemberRecord = aMemberRecord; ucMemberID1.StrBranchCode = aTerminalBranchCode; }
public bool SavePOS(ACMSLogic.POS pos) { ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider(); //ACMSDAL.ConnectionProvider connProvider1 = new ConnectionProvider(); try { DataTable branchReceiptNoTable = new DataTable(); int latestReceiptNo = GetLatestReceiptNo(connProvider, pos, ref branchReceiptNoTable) + 1; string receiptNo = pos.StrBranchCode.ToString().Trim() + pos.NTerminalID.ToString().Trim() + latestReceiptNo.ToString().Trim(); pos.StrReceiptNo = receiptNo; //Derek Instalment Plan Need to Add PaymentPlan Table Here //Get pos.NCategoryID here to determine if the item is Pay O/S //Here Can get the new Receipt No Value //3 Main table that always need to update TblReceipt receipt = new TblReceipt(); TblReceiptEntries receiptEntries = new TblReceiptEntries(); TblReceiptPayment receiptPayment = new TblReceiptPayment(); TblPaymentPlan myPaymentPlan = new TblPaymentPlan(); receipt.MainConnectionProvider = connProvider; receiptEntries.MainConnectionProvider = connProvider; receiptPayment.MainConnectionProvider = connProvider; myPaymentPlan.MainConnectionProvider = connProvider; connProvider.OpenConnection(); connProvider.BeginTransaction("SaveReceipt"); DataTable receiptTable = pos.ReceiptMasterTable.Copy(); DataTable receiptEntriesTable = pos.ReceiptItemsTable.Copy(); DataTable receiptPaymentTable = pos.ReceiptPaymentTable.Copy(); DataTable freeMemberPackageTable = receipt.FillSchema("Select * From tblMemberPackage"); // use to store the free member package. DataTable freeMemberCreditPackageTable = receipt.FillSchema("Select * From tblMemberCreditPackage"); if (pos.PaymentPlanTable != null && pos.NCategoryID != 0) { DataTable paymentPlanTable = pos.PaymentPlanTable.Copy(); if (paymentPlanTable != null && paymentPlanTable.Rows.Count > 0) { foreach (DataRow r in paymentPlanTable.Rows) { r["strReceiptNo"] = pos.StrReceiptNo; if (r["nInstalmentNo"].ToString() == "1") { r["strPaymentReceiptNo"] = pos.StrReceiptNo; myPaymentPlan.IPPPrimaryEntry(r["strReceiptNo"].ToString(), Convert.ToInt32(r["nInstalmentNo"]), r["strPaymentReceiptNo"].ToString(), Convert.ToDecimal(r["mPaymentPlanAmt"]), Convert.ToDecimal(r["mPaidAmount"]), Convert.ToDecimal(r["mAdjustedPaymentPlanAmt"]), Convert.ToDecimal(r["mOutstandingAmt"]), Convert.ToDateTime(r["dtPaymentDate"]), Convert.ToDateTime(r["dtDueDate"]), Convert.ToDateTime(r["dtFinalDueDate"]), Convert.ToInt32(r["nPaymentPlanID"])); } else { myPaymentPlan.IPPSubsequentEntry(r["strReceiptNo"].ToString(), Convert.ToInt32(r["nInstalmentNo"]), Convert.ToDecimal(r["mPaymentPlanAmt"]), Convert.ToDecimal(r["mPaidAmount"]), Convert.ToDecimal(r["mAdjustedPaymentPlanAmt"]), Convert.ToDecimal(r["mOutstandingAmt"]), Convert.ToDateTime(r["dtDueDate"]), Convert.ToDateTime(r["dtFinalDueDate"]), Convert.ToInt32(r["nPaymentPlanID"])); } } paymentPlanTable.AcceptChanges(); } pos.PaymentPlanTable.AcceptChanges(); } else if (pos.PaymentPlanTable != null && pos.NCategoryID == 0) { DataTable paymentPlanTable = pos.PaymentPlanTable.Copy(); if (paymentPlanTable != null && paymentPlanTable.Rows.Count > 0) { foreach (DataRow r in paymentPlanTable.Rows) { if (r["lastestUpdate"].ToString() == "1") { r["strPaymentReceiptNo"] = pos.StrReceiptNo; myPaymentPlan.IPPPrimaryUpdate(Convert.ToInt32(r["nPaymentPlanID"]), r["strReceiptNo"].ToString(), Convert.ToInt32(r["nInstalmentNo"]), r["strPaymentReceiptNo"].ToString(), Convert.ToDecimal(r["mPaidAmount"]), Convert.ToDecimal(r["mAdjustedPaymentPlanAmt"]), Convert.ToDecimal(r["mOutstandingAmt"]), Convert.ToDateTime(r["dtPaymentDate"])); } else { myPaymentPlan.IPPSubsequentUpdate(Convert.ToInt32(r["nPaymentPlanID"]), r["strReceiptNo"].ToString(), Convert.ToInt32(r["nInstalmentNo"]), Convert.ToDecimal(r["mPaidAmount"]), Convert.ToDecimal(r["mAdjustedPaymentPlanAmt"]), Convert.ToDecimal(r["mOutstandingAmt"])); } } //paymentPlanTable.AcceptChanges(); } pos.PaymentPlanTable.AcceptChanges(); } receipt.SaveData(receiptTable); receiptEntries.SaveData(receiptEntriesTable); receiptPayment.SaveData(receiptPaymentTable); receiptEntries.StrReceiptNo = pos.StrReceiptNo; DataTable savedReceiptEntriesTable = receiptEntries.SelectAllWstrReceiptNoLogic(); pos.ReceiptMasterTable.AcceptChanges(); if (pos.StrFreebieCode.HasValue && pos.StrFreebieCode.ToString() != "") { //Update Bill Freebie here if (pos.ReceiptFreebieTable.Rows.Count > 0) { TblReceiptFreebie receiptFreebie = new TblReceiptFreebie(); receiptFreebie.MainConnectionProvider = connProvider; DataTable receiptFreebieTable = pos.ReceiptFreebieTable.Copy(); // Save Bill Receipt Freebie receiptFreebie.SaveData(receiptFreebieTable); //TblProductInventory proInven = new TblProductInventory(); //proInven.MainConnectionProvider = connProvider; //// deduct stock //foreach (DataRow r in receiptFreebieTable.Rows) //{ // proInven.IncreaseQuantity(r["strItemCode"].ToString(), pos.StrBranchCode, -1); //} } if (pos.ReceiptPackageTable.Rows.Count > 0) { // update package foreach (DataRow r in pos.ReceiptPackageTable.Rows) { TblCreditPackage p = new TblCreditPackage(); p.StrCreditPackageCode = r["strPackageCode"].ToString(); p.SelectOne(); if (p.StrDescription.ToString() != "Null") { DataRow rowToAdd = freeMemberCreditPackageTable.NewRow(); ACMSLogic.MemberPackage.InitMemberCreditPackageRowInPOS(rowToAdd, pos.StrReceiptNo, pos.StrMembershipID, r["strPackageCode"].ToString(), r["strPromotionCode"].ToString(), true); // Add to freeMemberPackageTable and will save freeMemberCreditPackageTable.Rows.Add(rowToAdd); } else { DataRow rowToAdd = freeMemberPackageTable.NewRow(); ACMSLogic.MemberPackage.InitMemberPackageRowInPOS(rowToAdd, pos.StrReceiptNo, pos.StrMembershipID, r["strPackageCode"].ToString(), r["strPromotionCode"].ToString(), true); // Add to freeMemberPackageTable and will save freeMemberPackageTable.Rows.Add(rowToAdd); } } } //else //{ // throw new Exception("Bill Freebie have no free any product or package although the strFreebieCode is not null"); //} } if (pos.ReceiptItemsFreebiePackageTable.Rows.Count > 0) { foreach (DataRow r in pos.ReceiptItemsFreebiePackageTable.Rows) { TblCreditPackage p = new TblCreditPackage(); p.StrCreditPackageCode = r["strPackageCode"].ToString(); p.SelectOne(); if (p.StrDescription.ToString() != "Null") { DataRow rowToAdd = freeMemberCreditPackageTable.NewRow(); ACMSLogic.MemberPackage.InitMemberCreditPackageRowInPOS(rowToAdd, pos.StrReceiptNo, pos.StrMembershipID, r["strPackageCode"].ToString(), r["strPromotionCode"].ToString(), true); // Add to freeMemberPackageTable and will save freeMemberCreditPackageTable.Rows.Add(rowToAdd); } else { DataRow rowToAdd = freeMemberPackageTable.NewRow(); // Kean Yiap if (pos.NCategoryID == 34) { MemberPackage.InitMemberPackageRowInPOS(rowToAdd, pos.StrReceiptNo, pos.StrMembershipID, r["strPackageCode"].ToString(), "", true, -1, pos.dtPackageStart, pos.NProrateDays); } else { ACMSLogic.MemberPackage.InitMemberPackageRowInPOS(rowToAdd, pos.StrReceiptNo, pos.StrMembershipID, r["strPackageCode"].ToString(), r["strPromotionCode"].ToString(), true); } // Add to freeMemberPackageTable and will save freeMemberPackageTable.Rows.Add(rowToAdd); } } } if (pos.ReceiptItemsFreebieProductTable.Rows.Count > 0) { // Update product TblReceiptFreebie receiptFreebie = new TblReceiptFreebie(); receiptFreebie.MainConnectionProvider = connProvider; DataTable receiptItemsFreebieProductTable = pos.ReceiptFreebieTable.Clone(); // i have to use this structure bcoz i wan to save to this table; foreach (DataRow r in pos.ReceiptItemsFreebieProductTable.Rows) { DataRow rowToAdd = receiptItemsFreebieProductTable.NewRow(); rowToAdd["strReceiptNo"] = pos.StrReceiptNo; rowToAdd["strItemCode"] = r["strProductCode"]; rowToAdd["strPromotionCode"] = r["strPromotionCode"]; DataRow[] tempRows = savedReceiptEntriesTable.Select("nTempEntryID = " + r["nEntryID"].ToString(), "", DataViewRowState.CurrentRows); if (tempRows.Length > 0) rowToAdd["nEntryID"] = tempRows[0]["nEntryID"]; receiptItemsFreebieProductTable.Rows.Add(rowToAdd); } receiptFreebie.SaveData(receiptItemsFreebieProductTable); //TblProductInventory proInven = new TblProductInventory(); //proInven.MainConnectionProvider = connProvider; //foreach (DataRow r in receiptItemsFreebieProductTable.Rows) //{ // proInven.IncreaseQuantity(r["strItemCode"].ToString(), pos.StrBranchCode, -1); //} } if (freeMemberPackageTable.Rows.Count > 0) { // update the member package to database TblMemberPackage memberPackage = new TblMemberPackage(); memberPackage.MainConnectionProvider = connProvider; memberPackage.SaveData(freeMemberPackageTable); } if (freeMemberCreditPackageTable.Rows.Count > 0) { // update the member package to database TblMemberCreditPackage memberPackage = new TblMemberCreditPackage(); memberPackage.MainConnectionProvider = connProvider; memberPackage.SaveData(freeMemberCreditPackageTable); } //part 2 DeleteUselessIPP(connProvider, pos); UpdateRegistrationFee(connProvider, pos); UpdateOldPackSetDeactivate(connProvider, pos); //Update when upgrade PostToMemberCreditPackage(connProvider, pos); PostToMemberPackage(connProvider, pos); UpdateUsedCashVoucher(connProvider, pos); int ParentCategoryID = pos.NCategoryID; if (pos.NCategoryID == 10) { ParentCategoryID = UpgradePackage(connProvider, pos); if (ParentCategoryID == 10) { ParentCategoryID = UpgradeCreditPackage(connProvider, pos); } } TopUpCreditPackage(connProvider, pos); TopUpSingleTreatmentTransaction(connProvider, pos); MakeDeposit(connProvider, pos); CashVoucherTransaction(connProvider, pos); LockerTransaction(connProvider, pos); ForgetCardTransaction(connProvider, pos); ReplaceMembershipCardTransaction(connProvider, pos); //MineralWaterTransaction(connProvider, pos); TblRewards rewardcode = new TblRewards(); ACMSDAL.TblCategory category = new ACMSDAL.TblCategory(); category.NCategoryID = pos.NCategoryID; category.SelectOne(); int SalesCategory = ACMS.Convert.ToInt32(category.NSalesCategoryID); //Derek Instalment Plan - Here it assigned the Category to the Pay O/S Receipt Record if (pos.NCategoryID == 0) { ParentCategoryID = PayOutstanding(connProvider, pos); pos.StrRewardsCode = rewardcode.SelectRewards(ParentCategoryID, pos.StrBranchCode); } else pos.StrRewardsCode = rewardcode.SelectRewards(pos.NCategoryID, pos.StrBranchCode); if (pos.StrRewardsCode.HasValue && pos.StrRewardsCode.ToString() != "" && pos.StrRewardsCode.ToString() != "Null") { TblRewards rewards = new TblRewards(); rewards.StrRewardsCode = pos.StrRewardsCode.ToString(); rewards.SelectOne(); double dRewardPoint = 0; double dRewardPercent = (rewards.DRewardsPercent.IsNull ? 0 : rewards.DRewardsPercent.Value); double dRewardValue = (rewards.DRewardsValue.IsNull ? 0 : rewards.DRewardsValue.Value); //jackie 23 others give 50% GIRO //if (ParentCategoryID == 23 && pos.MNettAmount > 60)//pos.MNettAmount //{ // dRewardPercent = 50; //} if (dRewardPercent > 0 && dRewardValue == 0) { decimal mnettTotal = 0; if (pos.MOutstandingAmount > 0) { mnettTotal = pos.MNettAmount - (pos.MOutstandingAmount - pos.MGSTAmount); } else { mnettTotal = pos.MNettAmount; } dRewardPoint = ((double)mnettTotal) * dRewardPercent / 100; } else { if (pos.NCategoryID == 0) { dRewardPoint = dRewardValue; } } if (pos.NThisMonthBirthday == 1) { DialogResult result1 = MessageBox.Show("Member is having birthday this months. Do you want to give double point?", "Warning", MessageBoxButtons.YesNo); if (result1 == DialogResult.Yes) dRewardPoint *= 2; } TblRewardsTransaction rewardTran = new TblRewardsTransaction(); rewardTran.MainConnectionProvider = connProvider; if (pos.NCategoryID == 20) { rewardTran.StrMembershipID = pos.StrNewMembershipID; } else { rewardTran.StrMembershipID = pos.StrMembershipID; } rewardTran.DtDate = pos.DtDate; rewardTran.NTypeID = 1; rewardTran.NEmployeeID = pos.NCashierID; rewardTran.DRewardsPoints = dRewardPoint; rewardTran.StrReferenceNo = pos.StrReceiptNo; if (dRewardPoint > 0) // rewards point > 0 then insert records //3004 { rewardTran.Insert(); } } if (pos.StrRewardsCode.ToString() == "Null") pos.StrRewardsCode = ""; DataTable QtyTable = receiptEntries.Get_StrCodeReceiptNo(pos.StrReceiptNo); //check is the receipt fully paid string Nett = pos.MNettAmount.ToString(); string Outstanding = pos.MOutstandingAmount.ToString(); //if (pos.MOutstandingAmount == 0 && (pos.NCategoryID == 11 || pos.NCategoryID == 12)) // PostToStock(connProvider, QtyTable, pos); receiptTable = pos.ReceiptMasterTable.Copy(); int PosCategory = ACMS.Convert.ToInt32(receiptTable.Rows[0]["nCategoryID"]); if (PosCategory == 24) { receiptTable.Rows[0]["fDeposit"] = true; receipt.SaveData(receiptTable); } if (pos.StrBillReferenceNo != "") { receiptTable.Rows[0]["strBillReferenceNo"] = pos.StrBillReferenceNo; receipt.SaveData(receiptTable); } if (pos.NCategoryID == 0 || pos.NCategoryID == 10) { receipt.StrReceiptNo = pos.StrReceiptNo; receipt.SelectOne(); receipt.MOutstandingAmount = Convert.ToDecimal(pos.MOutstandingAmount); receipt.NCategoryID = ParentCategoryID; receipt.Update(); //TblReceipt receipt3 = new TblReceipt(); //receipt3.StrReceiptNo = pos.StrReceiptNo; //receipt3.SelectOne(); //receipt3.MOutstandingAmount = Convert.ToDecimal(pos.MOutstandingAmount); //receipt3.NCategoryID = ParentCategoryID; //receipt3.Update(); } if (pos.StrDeposit != "") { receipt.StrReceiptNo = pos.StrDeposit; DataTable tblDeposit = receipt.SelectOne(); if (tblDeposit.Rows.Count > 0) { receipt.FDeposit = false; receipt.Update(); } else { TblMemberPackage ConvertedPackage = new TblMemberPackage(); ConvertedPackage.NPackageID = ACMS.Convert.ToSqlInt32(pos.StrDeposit); ConvertedPackage.NStatusID = 1; ConvertedPackage.UpdateConvertedPackageStatus(); } } if (pos.ReceiptItemsTable.Select("", "", DataViewRowState.ModifiedCurrent).Length > 0) { receiptEntriesTable = pos.ReceiptItemsTable.Copy(); receipt.SaveData(receiptEntriesTable); } //1503 branchReceiptNoTable.Rows[0]["nReceiptNo"] = latestReceiptNo; SaveUpToDateReceiptNo(connProvider, branchReceiptNoTable); connProvider.CommitTransaction(); if (pos.StrDeposit != "") { TblReceipt receipt2 = new TblReceipt(); receipt2.StrReceiptNo = pos.StrDeposit; receipt2.SelectOne(); receipt2.StrChildReceiptNo = receiptNo; receipt2.Update(); } return true; } catch (Exception ex) { throw ex; } finally { if (connProvider.CurrentTransaction != null) connProvider.CurrentTransaction.Dispose(); if (connProvider.DBConnection != null) { if (connProvider.DBConnection.State == ConnectionState.Open) connProvider.DBConnection.Close(); } } }
private void btnSave_Click(object sender, EventArgs e) { strFreebiz = ""; bool is4 = false; bool is8 = false; if (lkpEdtSalesPersonID.Text == "") { UI.ShowErrorMessage(this, "Please select Sales Person"); lkpEdtSalesPersonID.Focus(); DialogResult = DialogResult.None; return; } else employeeID = ACMS.Convert.ToInt32(lkpEdtSalesPersonID.EditValue); if (txtName1.Text.ToString().Length == 0 && txtContact1.Text.ToString().Length == 0 && txtName2.Text.ToString().Length == 0 && txtContact2.Text.ToString().Length == 0 && txtName3.Text.ToString().Length == 0 && txtContact3.Text.ToString().Length == 0 && txtName4.Text.ToString().Length == 0 && txtContact4.Text.ToString().Length == 0) { UI.ShowErrorMessage(this, "Please enter 1st friend name & contact"); txtName1.Focus(); DialogResult = DialogResult.None; return; } if (txtName1.Text.ToString().Length != 0 || txtContact1.Text.ToString().Length != 0 || txtName2.Text.ToString().Length != 0 || txtContact2.Text.ToString().Length != 0 || txtName3.Text.ToString().Length != 0 || txtContact3.Text.ToString().Length != 0 || txtName4.Text.ToString().Length != 0 || txtContact4.Text.ToString().Length != 0) { if (txtName1.Text.ToString().Length == 0 && txtContact1.Text.ToString().Length == 0) { UI.ShowErrorMessage(this, "Please enter 1st friend name & contact"); txtName1.Focus(); DialogResult = DialogResult.None; return; } else if (txtName2.Text.ToString().Length == 0 && txtContact2.Text.ToString().Length == 0) { UI.ShowErrorMessage(this, "Please enter 2nd friend name & contact"); txtName2.Focus(); DialogResult = DialogResult.None; return; } else if (txtName3.Text.ToString().Length == 0 && txtContact3.Text.ToString().Length == 0) { UI.ShowErrorMessage(this, "Please enter 3rd friend name & contact"); txtName3.Focus(); DialogResult = DialogResult.None; return; } else if (txtName4.Text.ToString().Length == 0 && txtContact4.Text.ToString().Length == 0) { UI.ShowErrorMessage(this, "Please enter 4th friend name & contact"); txtName4.Focus(); DialogResult = DialogResult.None; return; } is4 = true; } if (txtName5.Text.ToString().Length != 0 || txtContact5.Text.ToString().Length != 0 || txtName6.Text.ToString().Length != 0 || txtContact6.Text.ToString().Length != 0 || txtName7.Text.ToString().Length != 0 || txtContact7.Text.ToString().Length != 0 || txtName8.Text.ToString().Length != 0 || txtContact8.Text.ToString().Length != 0) { if (txtName5.Text.ToString().Length == 0 && txtContact5.Text.ToString().Length == 0) { UI.ShowErrorMessage(this, "Please enter 5th friend name & contact"); txtName5.Focus(); DialogResult = DialogResult.None; return; } else if (txtName6.Text.ToString().Length == 0 && txtContact6.Text.ToString().Length == 0) { UI.ShowErrorMessage(this, "Please enter 6th friend name & contact"); txtName6.Focus(); DialogResult = DialogResult.None; return; } else if (txtName7.Text.ToString().Length == 0 && txtContact7.Text.ToString().Length == 0) { UI.ShowErrorMessage(this, "Please enter 7th friend name & contact"); txtName7.Focus(); DialogResult = DialogResult.None; return; } else if (txtName8.Text.ToString().Length == 0 && txtContact8.Text.ToString().Length == 0) { UI.ShowErrorMessage(this, "Please enter 8th friend name & contact"); txtName8.Focus(); DialogResult = DialogResult.None; return; } is4 = false; is8 = true; } if (ddl4Friends.Text.Length == 0 && is4) { UI.ShowErrorMessage(this, "Please select Reward for 4 friends!"); ddl4Friends.Focus(); DialogResult = DialogResult.None; return; } if (ddl8Friends.Text.Length == 0 && is8) { UI.ShowErrorMessage(this, "Please select Reward for 8 friends!"); ddl8Friends.Focus(); DialogResult = DialogResult.None; return; } if ((ddl4Friends.Text.Length != 0) && (ddl8Friends.Text.Length != 0)) { UI.ShowErrorMessage(this, "Please select only one Reward accordingly!"); DialogResult = DialogResult.None; return; } try { if (is4) { myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName1.Text, "", strTerminalBranchCode, "", cbGender1.Text, DateTime.Now, 13, "", txtContact1.Text, "",1); myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName2.Text, "", strTerminalBranchCode, "", cbGender2.Text, DateTime.Now, 13, "", txtContact2.Text, "", 1); myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName3.Text, "", strTerminalBranchCode, "", cbGender3.Text, DateTime.Now, 13, "", txtContact3.Text, "", 1); myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName4.Text, "", strTerminalBranchCode, "", cbGender4.Text, DateTime.Now, 13, "", txtContact4.Text, "", 1); TblRewards tr = new TblRewards(); ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider(); TblMember sqlMember = new TblMember(); TblRewardsTransaction sqlRewardsTransaction = new TblRewardsTransaction(); sqlRewardsTransaction.DRewardsPoints = Convert.ToInt16(ddl4Friends.EditValue.ToString()); sqlRewardsTransaction.DtDate = DateTime.Now; sqlRewardsTransaction.NEmployeeID = employeeID; sqlRewardsTransaction.NTypeID = 0; sqlRewardsTransaction.StrMembershipID = strMembershipID; sqlRewardsTransaction.StrReferenceNo = "4 Referral"; sqlRewardsTransaction.Insert(); } else if (is8) { myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName1.Text, "", strTerminalBranchCode, "", cbGender1.Text, DateTime.Now, 13, "", txtContact1.Text, "", 1); myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName2.Text, "", strTerminalBranchCode, "", cbGender2.Text, DateTime.Now, 13, "", txtContact2.Text, "", 1); myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName3.Text, "", strTerminalBranchCode, "", cbGender3.Text, DateTime.Now, 13, "", txtContact3.Text, "", 1); myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName4.Text, "", strTerminalBranchCode, "", cbGender4.Text, DateTime.Now, 13, "", txtContact4.Text, "", 1); myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName5.Text, "", strTerminalBranchCode, "", cbGender5.Text, DateTime.Now, 13, "", txtContact5.Text, "", 1); myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName6.Text, "", strTerminalBranchCode, "", cbGender6.Text, DateTime.Now, 13, "", txtContact6.Text, "", 1); myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName7.Text, "", strTerminalBranchCode, "", cbGender7.Text, DateTime.Now, 13, "", txtContact7.Text, "", 1); myContacts = new Contacts(); myContacts.NewContact(employeeID, txtName8.Text, "", strTerminalBranchCode, "", cbGender8.Text, DateTime.Now, 13, "", txtContact8.Text, "", 1); ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider(); TblMember sqlMember = new TblMember(); TblRewardsTransaction sqlRewardsTransaction = new TblRewardsTransaction(); sqlRewardsTransaction.DRewardsPoints = Convert.ToInt16(ddl8Friends.EditValue.ToString()); sqlRewardsTransaction.DtDate = DateTime.Now; sqlRewardsTransaction.NEmployeeID = employeeID; sqlRewardsTransaction.NTypeID = 0; sqlRewardsTransaction.StrMembershipID = strMembershipID; sqlRewardsTransaction.StrReferenceNo = "8 Referral"; sqlRewardsTransaction.Insert(); } MessageBox.Show("Intro Friends save successfully."); } catch (Exception ex) { MessageBox.Show(ex.Message); } this.Close(); }
public frmIntroduceFriendReferral(int aEmployeeID,string CurrentMembershipID,MemberRecord aMemberRecord, ACMSLogic.User oUser, string aStrTerminalBranchCode) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // myEmployeeIDLookupBuilder = new ACMS.XtraUtils.LookupEditBuilder.TherapistForPOSSalesLookupEditBuilder(lkpEdtSalesPersonID.Properties, aStrTerminalBranchCode); TblReceiptFreebie Freebie = new TblReceiptFreebie(); DataTable FreebieTable = Freebie.SelectIntro5FriendFreebie(); new XtraUtils.LookupEditBuilder.FriendPromotionLookupEditBuilder(FreebieTable, lkFreebie.Properties); TblReceiptFreebie Freebie2 = new TblReceiptFreebie(); DataTable FreebieTable2 = Freebie.SelectIntro10FriendFreebie(); new XtraUtils.LookupEditBuilder.FriendPromotionLookupEditBuilder(FreebieTable2, lkFreebie2.Properties); TblRewards rewards4 = new TblRewards(); DataTable rewards4Table = rewards4.SelectRewardsForReferral(4, aStrTerminalBranchCode); new XtraUtils.LookupEditBuilder.LoyalPointsLookupEditBuilder(rewards4Table, ddl4Friends.Properties); TblRewards rewards8 = new TblRewards(); DataTable rewards8Table = rewards8.SelectRewardsForReferral(8, aStrTerminalBranchCode); new XtraUtils.LookupEditBuilder.LoyalPointsLookupEditBuilder(rewards8Table, ddl8Friends.Properties); strMembershipID = CurrentMembershipID; strTerminalBranchCode = aStrTerminalBranchCode; employeeID = aEmployeeID; myMemberRecord = aMemberRecord; myUser = oUser; ucNonMemberID1.StrBranchCode = aStrTerminalBranchCode; ucNonMemberID2.StrBranchCode = aStrTerminalBranchCode; ucNonMemberID3.StrBranchCode = aStrTerminalBranchCode; ucNonMemberID4.StrBranchCode = aStrTerminalBranchCode; ucNonMemberID5.StrBranchCode = aStrTerminalBranchCode; ucNonMemberID6.StrBranchCode = aStrTerminalBranchCode; ucNonMemberID7.StrBranchCode = aStrTerminalBranchCode; ucNonMemberID8.StrBranchCode = aStrTerminalBranchCode; ucNonMemberID9.StrBranchCode = aStrTerminalBranchCode; ucNonMemberID10.StrBranchCode = aStrTerminalBranchCode; TblPromotionIntroFriends sqlPromotionIntroFriends = new TblPromotionIntroFriends(); DataTable PromotionIntroFriends = sqlPromotionIntroFriends.SelectAllPromotionIntroFriends(strMembershipID); myContacts = new Contacts(); if (PromotionIntroFriends.Rows.Count > 0) { txtSerialNo.Text = PromotionIntroFriends.Rows[0]["strSerialNo"].ToString(); chkIssued.Checked = (PromotionIntroFriends.Rows[0]["fIssued"] == DBNull.Value || PromotionIntroFriends.Rows[0]["fIssued"].ToString() == "False" ? false : true); ucNonMemberID1.EditValue = PromotionIntroFriends.Rows[0]["strFriendID01"].ToString(); ucNonMemberID1.Enabled = (ucNonMemberID1.EditValue == ""); ucNonMemberID2.EditValue = PromotionIntroFriends.Rows[0]["strFriendID02"].ToString(); ucNonMemberID2.Enabled = (ucNonMemberID2.EditValue == ""); ucNonMemberID3.EditValue = PromotionIntroFriends.Rows[0]["strFriendID03"].ToString(); ucNonMemberID3.Enabled = (ucNonMemberID3.EditValue == ""); ucNonMemberID4.EditValue = PromotionIntroFriends.Rows[0]["strFriendID04"].ToString(); ucNonMemberID4.Enabled = (ucNonMemberID4.EditValue == ""); ucNonMemberID5.EditValue = PromotionIntroFriends.Rows[0]["strFriendID05"].ToString(); ucNonMemberID5.Enabled = (ucNonMemberID5.EditValue == ""); ucNonMemberID6.EditValue = PromotionIntroFriends.Rows[0]["strFriendID05"].ToString(); ucNonMemberID6.Enabled = (ucNonMemberID6.EditValue == ""); ucNonMemberID7.EditValue = PromotionIntroFriends.Rows[0]["strFriendID05"].ToString(); ucNonMemberID7.Enabled = (ucNonMemberID7.EditValue == ""); ucNonMemberID8.EditValue = PromotionIntroFriends.Rows[0]["strFriendID05"].ToString(); ucNonMemberID8.Enabled = (ucNonMemberID8.EditValue == ""); ucNonMemberID9.EditValue = PromotionIntroFriends.Rows[0]["strFriendID05"].ToString(); ucNonMemberID9.Enabled = (ucNonMemberID9.EditValue == ""); ucNonMemberID10.EditValue = PromotionIntroFriends.Rows[0]["strFriendID05"].ToString(); ucNonMemberID10.Enabled = (ucNonMemberID10.EditValue == ""); lkFreebie.EditValue = PromotionIntroFriends.Rows[0]["strFreebieCode"].ToString(); } //if (ACMS.Convert.ToInt32(PromotionIntroFriends.Rows[0]["nMaxSession"]) == 9999) // needtoAddBackOneDayExpiryDate = true; // //DataTable attendedClassTable = classAttendance.GetAllClassAttendancesBasePackageID(wantToUpgrade_nPackageID, pos.StrMembershipID, pos.StrBranchCode); //txtSerialNo.Text = "A1"; //ucNonMemberID1.EditValue = "aa"; ComboboxItem itemFemale = new ComboboxItem(); itemFemale.Text = "Female"; itemFemale.Value = "F"; ComboboxItem itemMale = new ComboboxItem(); itemMale.Text = "Male"; itemMale.Value = "M"; cbGender1.Items.Add(itemFemale); cbGender1.Items.Add(itemMale); cbGender1.SelectedIndex = 0; cbGender2.Items.Add(itemFemale); cbGender2.Items.Add(itemMale); cbGender2.SelectedIndex = 0; cbGender3.Items.Add(itemFemale); cbGender3.Items.Add(itemMale); cbGender3.SelectedIndex = 0; cbGender4.Items.Add(itemFemale); cbGender4.Items.Add(itemMale); cbGender4.SelectedIndex = 0; cbGender5.Items.Add(itemFemale); cbGender5.Items.Add(itemMale); cbGender5.SelectedIndex = 0; cbGender6.Items.Add(itemFemale); cbGender6.Items.Add(itemMale); cbGender6.SelectedIndex = 0; cbGender7.Items.Add(itemFemale); cbGender7.Items.Add(itemMale); cbGender7.SelectedIndex = 0; cbGender8.Items.Add(itemFemale); cbGender8.Items.Add(itemMale); cbGender8.SelectedIndex = 0; }