示例#1
0
		private void RewardCardReplacement(RewardCardStatus pvtRewardCardStatus)
		{
			if (mboIsInTransaction)
			{
				MessageBox.Show("Sorry you cannot replace a Reward Card while there is an ongoing transaction. Please finish the transaction first.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return;
			}

			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.RewardCardChange);

			if (loginresult == DialogResult.OK)
			{
				try
				{
					DialogResult result; Data.ContactDetails clsContactDetails;
					ContactSelectWnd clsContactWnd = new ContactSelectWnd();
                    clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK;
                    clsContactWnd.SysConfigDetails = mclsSysConfigDetails;
                    clsContactWnd.TerminalDetails = mclsTerminalDetails;
					clsContactWnd.ContactGroupCategory = AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER;
                    clsContactWnd.Header = "Please select customer for reward card replacement.";
					clsContactWnd.ShowDialog(this);
					clsContactDetails = clsContactWnd.Details;
					result = clsContactWnd.Result;
					clsContactWnd.Close();
					clsContactWnd.Dispose();

					if (result != DialogResult.OK)
					{ return; }

					if (clsContactDetails.ContactID == Constants.ZERO || clsContactDetails.ContactID == Constants.C_RETAILPLUS_CUSTOMERID)
					{ return; }

					clsEvent.AddEvent("[" + lblCashier.Text + "] Replacing reward card...");

					Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                    mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

					clsContactDetails = clsContact.Details(clsContactDetails.ContactID);
					clsContact.CommitAndDispose();

					if (clsContactDetails.RewardDetails.RewardCardNo == string.Empty || clsContactDetails.RewardDetails.RewardCardNo == null)
					{
						clsEvent.AddEventLn("Cancelled!");
						clsEvent.AddEventLn(clsContactDetails.ContactName + " has no valid Reward Card yet. ");
						MessageBox.Show(clsContactDetails.ContactName + " has no valid Reward Card yet. Please select another customer.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
						return;
					}
					clsEvent.AddEvent("[" + lblCashier.Text + "] Replacing reward card #: " + clsContactDetails.RewardDetails.RewardCardNo + " of " + clsContactDetails.ContactName + " as " + pvtRewardCardStatus.ToString("G"));

					string strOldRewardCardNo = clsContactDetails.RewardDetails.RewardCardNo;
					ContactRewardWnd clsContactRewardWnd = new ContactRewardWnd();
                    clsContactRewardWnd.TerminalDetails = mclsTerminalDetails;
					if (pvtRewardCardStatus == RewardCardStatus.Replaced_Lost)
						clsContactRewardWnd.Caption = "Reward Card Replacement of LOST CARD ";
					else if (pvtRewardCardStatus == RewardCardStatus.Replaced_Expired)
						clsContactRewardWnd.Caption = "Reward Card Replacement of EXPIRED CARD ";
					clsContactRewardWnd.ContactDetails = clsContactDetails;
					clsContactRewardWnd.RewardCardStatus = pvtRewardCardStatus;
					clsContactRewardWnd.ShowDialog(this);
					result = clsContactRewardWnd.Result;
					clsContactDetails = clsContactRewardWnd.ContactDetails;
					clsContactRewardWnd.Close();
					clsContactRewardWnd.Dispose();

					if (result == DialogResult.OK)
					{
                        Data.Products clsProducts = new Data.Products(mConnection, mTransaction);
                        mConnection = clsProducts.Connection; mTransaction = clsProducts.Transaction;

                        if (clsProducts.Details(Data.Products.DEFAULT_ADVANTAGE_CARD_REPLACEMENT_FEE_BARCODE).ProductID == 0)
                        {
                            clsProducts.CREATE_ADVANTAGE_CARD_REPLACEMENT_FEE_BARCODE_PRODUCT();
                            Methods.InsertAuditLog(mclsTerminalDetails, "System Administrator", AccessTypes.RewardCardChange, "ADVANTAGE_CARD_REPLACEMENT_FEE_BARCODE product has been created coz it's not configured");
                        }
                        clsProducts.CommitAndDispose();

						MessageBox.Show("Reward Card No: " + strOldRewardCardNo + " has been replaced with new card #: " + clsContactDetails.RewardDetails.RewardCardNo + ".", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);

						clsEvent.AddEventLn("Done!", true);
						clsEvent.AddEventLn("Reward Card No: " + strOldRewardCardNo + " has been replaced with new card #: " + clsContactDetails.RewardDetails.RewardCardNo + ".", true);

                        LocalDB clsLocalDB = new LocalDB(mConnection, mTransaction);
                        mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction;

						clsEvent.AddEvent("[" + lblCashier.Text + "] Creating " + Data.Products.DEFAULT_ADVANTAGE_CARD_REPLACEMENT_FEE_BARCODE + "transaction for customer: ");
						LoadContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER, clsContactDetails);
						if (!this.CreateTransaction()) return;

						txtBarCode.Text = Data.Products.DEFAULT_ADVANTAGE_CARD_REPLACEMENT_FEE_BARCODE;
						ReadBarCode();
						int iRow = dgItems.CurrentRowIndex;

						txtBarCode.Text = "";
						CloseTransaction();

                        clsLocalDB.CommitAndDispose();
					}
					else { clsEvent.AddEventLn("Cancelled!"); }
				}
				catch (Exception ex)
				{ 
                    InsertErrorLogToFile(ex, "ERROR!!! Replacing reward card."); 
                }
				Cursor.Current = Cursors.Default;
			}
		}
示例#2
0
		private void RewardCardDeclareAsLost()
		{
			if (mboIsInTransaction)
			{
				MessageBox.Show("Sorry you cannot declare a Reward Card as LOST while there is an ongoing transaction. Please finish the transaction first.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return;
			}

			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.RewardCardChange, "Reward Card Declaration as LOST");

            if (loginresult == DialogResult.OK)
			{
				try
				{
					DialogResult result; Data.ContactDetails clsContactDetails;
					ContactSelectWnd clsContactWnd = new ContactSelectWnd();
                    clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK;
                    clsContactWnd.SysConfigDetails = mclsSysConfigDetails;
                    clsContactWnd.TerminalDetails = mclsTerminalDetails;
					clsContactWnd.ContactGroupCategory = AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER;
                    clsContactWnd.Header = "Please select customer for reward card declaration as lost.";
					clsContactWnd.ShowDialog(this);
					clsContactDetails = clsContactWnd.Details;
					result = clsContactWnd.Result;
					clsContactWnd.Close();
					clsContactWnd.Dispose();

					if (result != DialogResult.OK)
					{ return; }

					if (clsContactDetails.ContactID == Constants.ZERO || clsContactDetails.ContactID == Constants.C_RETAILPLUS_CUSTOMERID)
					{ return; }

					clsEvent.AddEvent("[" + lblCashier.Text + "] Declaring reward card as LOST.");

					Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                    mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

					clsContactDetails = clsContact.Details(clsContactDetails.ContactID);
					clsContact.CommitAndDispose();

					if (clsContactDetails.RewardDetails.RewardCardNo == string.Empty || clsContactDetails.RewardDetails.RewardCardNo == null)
					{
						clsEvent.AddEventLn("Cancelled!");
						clsEvent.AddEventLn(clsContactDetails.ContactName + " has no valid Reward Card yet. ");
						MessageBox.Show(clsContactDetails.ContactName + " has no valid Reward Card yet. Please select another customer.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
						return;
					}

					ContactRewardWnd clsContactRewardWnd = new ContactRewardWnd();
                    clsContactRewardWnd.TerminalDetails = mclsTerminalDetails;
					clsContactRewardWnd.Caption = "Reward Card Declaration as LOST";
					clsContactRewardWnd.ContactDetails = clsContactDetails;
					clsContactRewardWnd.RewardCardStatus = RewardCardStatus.Lost;
					clsContactRewardWnd.ShowDialog(this);
					result = clsContactRewardWnd.Result;
					clsContactDetails = clsContactRewardWnd.ContactDetails;
					clsContactRewardWnd.Close();
					clsContactRewardWnd.Dispose();

					if (result == DialogResult.OK)
					{
						MessageBox.Show("Reward Card No: " + clsContactDetails.RewardDetails.RewardCardNo + " has been declared as LOST.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);

						clsEvent.AddEventLn("Done!", true);
						clsEvent.AddEventLn("Reward Card No: " + clsContactDetails.RewardDetails.RewardCardNo + " has been declared as LOST.", true);
						this.LoadOptions();
					}
					else { clsEvent.AddEventLn("Cancelled!"); }
				}
				catch (Exception ex)
				{ 
                    InsertErrorLogToFile(ex,"ERRROR!!! Declaring reward card as lost."); 
                }
				Cursor.Current = Cursors.Default;
			}
		}
示例#3
0
		private void IssueRewardCard()
		{
			if (mboIsInTransaction)
			{
				MessageBox.Show("Sorry you cannot issue a Reward Card while there is an ongoing transaction. Please finish the transaction first.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return;
			}

			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.RewardCardIssuance);

            if (loginresult == DialogResult.OK)
			{
				try
				{
					DialogResult result; Data.ContactDetails clsContactDetails;
					ContactSelectWnd clsContactWnd = new ContactSelectWnd();
                    clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK;
                    clsContactWnd.SysConfigDetails = mclsSysConfigDetails;
                    clsContactWnd.TerminalDetails = mclsTerminalDetails;
					clsContactWnd.ContactGroupCategory = AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER;
                    clsContactWnd.Header = "Please select customer for reward card issuance.";
					clsContactWnd.ShowDialog(this);
					clsContactDetails = clsContactWnd.Details;
					result = clsContactWnd.Result;
					clsContactWnd.Close();
					clsContactWnd.Dispose();

					if (result != DialogResult.OK)
					{ return; }

					if (clsContactDetails.ContactID == Constants.ZERO || clsContactDetails.ContactID == Constants.C_RETAILPLUS_CUSTOMERID)
					{ return; }

					clsEvent.AddEvent("[" + lblCashier.Text + "] Issuing reward card no to " + clsContactDetails.ContactName);

					Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
					clsContactDetails = clsContact.Details(clsContactDetails.ContactID);
					clsContact.CommitAndDispose();

					if (clsContactDetails.RewardDetails.RewardCardNo != string.Empty && clsContactDetails.RewardDetails.RewardCardNo != null)
					{
						clsEvent.AddEventLn("Cancelled!");
						clsEvent.AddEventLn("Reward Card No: " + clsContactDetails.RewardDetails.RewardCardNo + " was already issued to " + clsContactDetails.ContactName + " on " + clsContactDetails.RewardDetails.RewardAwardDate.ToString("MMM dd, yyyy hh:mm tt"));
						MessageBox.Show("Reward Card No: " + clsContactDetails.RewardDetails.RewardCardNo + " was already issued to " + clsContactDetails.ContactName + " on " + clsContactDetails.RewardDetails.RewardAwardDate.ToString("MMM dd, yyyy hh:mm tt") + "." + 
										Environment.NewLine + " Please select another customer to issue Reward Card.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
						return;
					}
					
					clsEvent.AddEvent("[" + lblCashier.Text + "] Issuing reward card no to " + clsContactDetails.ContactName);

					ContactRewardWnd clsContactRewardWnd = new ContactRewardWnd();
                    clsContactRewardWnd.TerminalDetails = mclsTerminalDetails;
					clsContactRewardWnd.Caption = "Reward Card Issuance";
					clsContactRewardWnd.ContactDetails = clsContactDetails;
					clsContactRewardWnd.RewardCardStatus = RewardCardStatus.New;
					clsContactRewardWnd.ShowDialog(this);
					result = clsContactRewardWnd.Result;
					clsContactDetails = clsContactRewardWnd.ContactDetails;
					clsContactRewardWnd.Close();
					clsContactRewardWnd.Dispose();

					if (result == DialogResult.OK)
					{
                        Data.Products clsProducts = new Data.Products(mConnection, mTransaction);
                        mConnection = clsProducts.Connection; mTransaction = clsProducts.Transaction;

                        if (clsProducts.Details(Data.Products.DEFAULT_ADVANTAGE_CARD_MEMBERSHIP_FEE_BARCODE).ProductID == 0)
                        {
                            clsProducts.CREATE_ADVANTAGE_CARD_MEMBERSHIP_FEE_BARCODE_PRODUCT();
                            Methods.InsertAuditLog(mclsTerminalDetails, "System Administrator", AccessTypes.RewardCardIssuance, "ADVANTAGE_CARD_MEMBERSHIP_FEE_BARCODE product has been created coz it's not configured");
                        }
                        clsProducts.CommitAndDispose();

						MessageBox.Show("Reward Card No: " + clsContactDetails.RewardDetails.RewardCardNo + " was issued to " + clsContactDetails.ContactName + "." + 
										Environment.NewLine + "Please collect the payment then close the transaction.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);

						clsEvent.AddEventLn("Done!", true);
						clsEvent.AddEventLn("Reward Card No: " + clsContactDetails.RewardDetails.RewardCardNo + " was issued to " + clsContactDetails.ContactName + ".", true);

                        LocalDB clsLocalDB = new LocalDB(mConnection, mTransaction);
                        mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction;

						clsEvent.AddEvent("[" + lblCashier.Text + "] Creating " + Data.Products.DEFAULT_ADVANTAGE_CARD_MEMBERSHIP_FEE_BARCODE + "transaction for customer: ");
						LoadContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER, clsContactDetails);
						if (!this.CreateTransaction()) return;

						txtBarCode.Text = Data.Products.DEFAULT_ADVANTAGE_CARD_MEMBERSHIP_FEE_BARCODE;
						ReadBarCode();
						int iRow = dgItems.CurrentRowIndex;
						
						txtBarCode.Text = "";
						CloseTransaction();

                        clsLocalDB.CommitAndDispose();
					}
					else { clsEvent.AddEventLn("Cancelled!"); }
				}
				catch (Exception ex)
                { 
                    InsertErrorLogToFile(ex, "ERROR!!! Issuing reward card."); 
                }
				Cursor.Current = Cursors.Default;
			}
			
		}