Exemple #1
0
        public CUseDepositForm(CDeposit inDeposit)
        {
            InitializeComponent();

            m_oDeposit = inDeposit;
            SerialNumberLabel.Text = m_oDeposit.DepositID.ToString();

            g_TotalLabel.Text = "£" +m_oDeposit.DepositTotalAmount.ToString("F02");
            DepositTypeLabel.Text = m_oDeposit.DepositType;
            g_BalanceLabel.Text = "£" + m_oDeposit.DepositBalance.ToString("F02");
        }
Exemple #2
0
        public CResult InsertDeposit(CDeposit inDeposit)
        {
            CResult oResult = new CResult();

            try
            {

                this.OpenConnection();
                string sSql = String.Format(SqlQueries.GetQuery(Query.DepositInsert), inDeposit.DepositBalance, inDeposit.DepositTime, inDeposit.CustomerID, inDeposit.DepositTotalAmount,inDeposit.PcID,inDeposit.Status,inDeposit.DepositType);
                this.ExecuteNonQuery(sSql);

                sSql = SqlQueries.GetQuery(Query.ScopeIdentity);

                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    bool bIsRead = oReader.Read();
                    if (bIsRead)
                    {

                        inDeposit.DepositID = Int64.Parse(oReader[0].ToString());
                    }
                    oReader.Close();
                }

                oResult.Data = inDeposit;
                oResult.IsSuccess = true;
            }

            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in InsertDeposit()", LogLevel.Error, "Database");

                //throw new Exception("Exception occure at OrderDetailsInsert()", ex);
                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }

            return oResult;
        }
Exemple #3
0
        public CResult InsertDeposit(CDeposit inDeposit)
        {
            try
            {
                m_oResult = Database.Instance.Deposit.InsertDeposit(inDeposit);

                m_oResult.Message = "Data Inserted Successfully";

            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Exception occuer at InsertDeposit() : " + ex.Message);

                m_oResult.Action = EERRORNAME.EXCEPTION_OCCURE;
                //m_oResult.SetParams(ex.Message);

                m_oResult.Message = ex.Message;
                Logger.Write("Exception : " + ex + " in InsertDeposit()", LogLevel.Error, "CDepositManager");
            }
            return m_oResult;
        }
Exemple #4
0
        public CResult GetDepositByDepositID(Int64 inDepositID)
        {
            CResult oResult = new CResult();

            try
            {
                CDeposit tempDeposit = new CDeposit();
                this.OpenConnection();
                string sSql = String.Format(SqlQueries.GetQuery(Query.DepositGetByDepositID), inDepositID);

                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    bool bIsRead = oReader.Read();
                    if (bIsRead)
                    {

                        tempDeposit = ReaderToDeposit(oReader);
                    }
                    oReader.Close();
                }

                oResult.Data = tempDeposit;
                oResult.IsSuccess = true;
            }

            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in InsertDeposit()", LogLevel.Error, "Database");

                //throw new Exception("Exception occure at OrderDetailsInsert()", ex);
                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }

            return oResult;
        }
Exemple #5
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                CDepositManager tempDepositManager = new CDepositManager();
                CDeposit tempDeposit = new CDeposit();

                Double tempCash = 0.000;
                Double tempEFT = 0.000;
                Double tempCheque = 0.000;
                Double tempAccount = 0.000;
                Double tempTotal = 0.000;

                Double.TryParse(g_CashLabel.Text.Substring(1), out tempCash);
                Double.TryParse(g_EFTLabel.Text.Substring(1), out tempEFT);
                Double.TryParse(g_ChequeLabel.Text.Substring(1), out tempCheque);
                Double.TryParse(g_AccountLabel.Text.Substring(1), out tempAccount);
                Double.TryParse(g_DepositTotalLabel.Text.Substring(1), out tempTotal);

                if (tempTotal == 0)
                {
                    MessageBox.Show("Zero amount given for deposit. Please recheck", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                tempDeposit.DepositBalance = tempTotal;
                tempDeposit.DepositTime = DateTime.Now.Ticks;
                tempDeposit.CustomerID=m_iCustomerID;
                tempDeposit.DepositTotalAmount = tempTotal;
                tempDeposit.DepositType = m_sDepositType;
                tempDeposit.Status = 1;

                CPcInfoManager tempPcInfoManager = new CPcInfoManager();
                IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName());
                CPcInfo tempPcInfo=new CPcInfo();
                CResult oResult= tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString());
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempPcInfo = (CPcInfo)oResult.Data;
                }
                tempDeposit.PcID = tempPcInfo.PcID;

                oResult = tempDepositManager.InsertDeposit(tempDeposit);
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempDeposit = (CDeposit)oResult.Data;
                }

                //get customer name & phone
                CCustomerManager tempCustomerManager= new CCustomerManager();
                CCustomerInfo tempCustomerInfo= new CCustomerInfo();
                oResult = tempCustomerManager.CustomerInfoGetByCustomerID(m_iCustomerID);
                if(oResult.IsSuccess && oResult.Data!=null)
                {
                    tempCustomerInfo = (CCustomerInfo)oResult.Data;
                }

                //string serialBody = "\r\n         Deposit Token\r\n";
                //serialBody += "\r\n         Customer Name: "+tempCustomerInfo.CustomerName;
                //serialBody += "\r\n         Phone: " + tempCustomerInfo.CustomerPhone+"\r\n";

                //serialBody += "\r\n         By " + tempDeposit.DepositType;
                //serialBody += "\r\n---------------------------------";
                //serialBody += "\r\n         Total: " + tempDeposit.DepositBalance.ToString("F02");
                //serialBody += "\r\n";
                //serialBody += "\r\nS/N: " + tempDeposit.DepositID.ToString();

                string serialBody = "\r\n                Deposit Token\r\n";
                DateTime tempODate = new DateTime(tempDeposit.DepositTime);
                string tempODateString = "Deposit Date: " + tempODate.ToLongDateString();
                serialBody += "".PadRight((int)((45 - tempODateString.Length) / 2), ' ') + tempODateString.Trim() + "\r\n";
                string tempDateString = "Reprint Date: " + DateTime.Now.ToLongDateString();
                serialBody += "".PadRight((int)((45 - tempDateString.Length) / 2), ' ') + tempDateString.Trim() + "\r\n\r\n";
                serialBody += "Customer Name: " + tempCustomerInfo.CustomerName + "\r\n";
                string tempAddressString = "Customer Address: " + tempCustomerInfo.CustomerAddress.Trim();
                if (tempAddressString.Length > 40)
                {
                    tempAddressString = tempAddressString.Substring(0, 40) + "\r\n".PadRight(19, ' ') + tempAddressString.Substring(40);
                }
                serialBody += tempAddressString + "\r\n";
                serialBody += "Phone: " + tempCustomerInfo.CustomerPhone + "\r\n\r\n";
                serialBody += "Deposit Type:     " + tempDeposit.DepositType + "\r\n";
                serialBody += "Deposited Amount: " + tempDeposit.DepositTotalAmount.ToString("F02") + "\r\n";
                double tempDepositUsed = (tempDeposit.DepositTotalAmount - tempDeposit.DepositBalance);
                serialBody += "Deposit Used:     " + tempDepositUsed.ToString("F02") + "\r\n";
                serialBody += "---------------------------------\r\n";
                serialBody += "Total Balance:    " + tempDeposit.DepositBalance.ToString("F02") + "\r\n\r\n";
                serialBody += "S/N: " + tempDeposit.DepositID.ToString() + "\r\n";

                CPrintMethods tempPrintMethods = new CPrintMethods();
                tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER,"",serialBody,"",tempDeposit.DepositID.ToString());
                this.Close();

            }
            catch (Exception eee)
            {
            }
        }
Exemple #6
0
        private void DepositSearchButton_Click(object sender, EventArgs e)
        {
            try
            {
                Int64 tempDepositSerial = Int64.Parse(DepositSerialTextBox.Text.Trim());
                DepositDataGridView.Rows.Clear();
                CDepositManager tempDepositManager = new CDepositManager();
                CDeposit tempDeposit = new CDeposit();
                CResult oResult = tempDepositManager.DepositGetByDepositID(tempDepositSerial);
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempDeposit = (CDeposit)oResult.Data;
                }
                if (tempDeposit.DepositBalance != 0)
                {

                    string[] newRow ={
                tempDeposit.DepositID.ToString(),
                new DateTime(tempDeposit.DepositTime).ToShortDateString(),
                tempDeposit.DepositTotalAmount.ToString("F02"),
                tempDeposit.DepositBalance.ToString("F02"),
                tempDeposit.DepositType
                };

                    CCustomerManager tempCustomerManager = new CCustomerManager();
                    CCustomerInfo tempCustomerInfo = new CCustomerInfo();
                    oResult = tempCustomerManager.CustomerInfoGetByCustomerID(tempDeposit.CustomerID);
                    if (oResult.IsSuccess && oResult.Data != null)
                    {
                        tempCustomerInfo = (CCustomerInfo)oResult.Data;
                    }
                    CustomerLabel.Text = tempCustomerInfo.CustomerName;
                    PhoneLabel.Text = tempCustomerInfo.CustomerPhone;

                    DepositDataGridView.Rows.Add(newRow);
                }
                else
                {
                    MessageBox.Show("No deposit information found. This deposit may be already used or never existed.", "Info",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                DepositDataGridView.RowCount = 13;

            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemple #7
0
        private CDeposit ReaderToDeposit(IDataReader inReader)
        {
            CDeposit tempDeposit = new CDeposit();

            if (inReader["deposit_id"] != null)
                tempDeposit.DepositID = Int64.Parse(inReader["deposit_id"].ToString());

            if (inReader["balance"] != null)
                tempDeposit.DepositBalance = Double.Parse(inReader["balance"].ToString());

            if (inReader["deposit_time"] != null)
                tempDeposit.DepositTime = Int64.Parse(inReader["deposit_time"].ToString());

            if (inReader["customer_id"] != null)
                tempDeposit.CustomerID = Int64.Parse(inReader["customer_id"].ToString());

            if (inReader["total_amount"] != null)
                tempDeposit.DepositTotalAmount = Double.Parse(inReader["total_amount"].ToString());

            if (inReader["pc_id"] != null)
                tempDeposit.PcID = Int32.Parse(inReader["pc_id"].ToString());

            if (inReader["status"] != null)
                tempDeposit.Status = Int32.Parse(inReader["status"].ToString());

            if (inReader["deposit_type"] != null)
                tempDeposit.DepositType = inReader["deposit_type"].ToString();

            return tempDeposit;
        }
Exemple #8
0
        public CResult UpdateDeposit(CDeposit inDeposit)
        {
            CResult oResult = new CResult();

            try
            {

                this.OpenConnection();
                string sSql;

                sSql = String.Format(SqlQueries.GetQuery(Query.DepositUpdate), inDeposit.DepositBalance, inDeposit.DepositTime, inDeposit.CustomerID, inDeposit.DepositTotalAmount, inDeposit.PcID, inDeposit.Status, inDeposit.DepositType, inDeposit.DepositID);

                this.ExecuteNonQuery(sSql);

                oResult.IsSuccess = true;
            }

            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in UpdateDeposit()", LogLevel.Error, "Database");

                //throw new Exception("Exception occure at OrderDetailsInsert()", ex);
                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }

            return oResult;
        }
Exemple #9
0
        public CPaymentForm(Int64 inOrderID, Double inTotalAmount, String inTableType, DataTable inItemList, decimal inDiscount, int drinksIndex, string terminalName, string operatorName, string serviceCharge,decimal inMembershipdiscount)
        {
            eFTCardManager = new EFTCardManager();

            if (!isVatEnabled)
            {
                vat = 0.00;
            }

            InitializeComponent();

            g_BalaceLabel.Text = Program.currency + "0.00";
            g_BillTotalLabel.Text = Program.currency + "0.00";
            g_CashLabel.Text = Program.currency + "0.00";
            g_ChequeLabel.Text = Program.currency + "0.00";
            g_DiscountLabel.Text = Program.currency + "0.00";
            g_EFTLabel.Text = Program.currency + "0.00";
            g_SplitAmountLabel.Text = Program.currency + "0.00";
            g_ServiceChargeLabel.Text = Program.currency + "0.00";
            g_VoucherLabel.Text = Program.currency + "0.00";
            g_AccountLabel.Text = Program.currency + "0.00";
            g_DepositUsedLabel.Text = Program.currency + "0.00";
            g_InputTextBox.Text = Program.currency + "0.00";
            membershipdiscountlabel.Text = Program.currency + "0.00";
            g_InputTextBox.MaxLength = 20;

            currencyKeyPad1.CurrencySign = Program.currency;

            m_OperatorName = operatorName;
            m_TerminalName = terminalName;

            m_cCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
            String ConnectionString = m_cCommonConstants.DBConnection;
            SqlDataAdapter daCategory3 = new SqlDataAdapter(SqlQueries.GetQuery(Query.Category3GetAll), ConnectionString);
            daCategory3.Fill(dsCategory3, "Category3");
            daCategory3.Dispose();

            SqlDataAdapter daCategory4 = new SqlDataAdapter(SqlQueries.GetQuery(Query.Category4GetAll), ConnectionString);
            daCategory4.Fill(dsCategory4, "Category4");
            daCategory4.Dispose();

            SqlDataAdapter tempSqlDataAdapter5 = new SqlDataAdapter(SqlQueries.GetQuery(Query.Category2GetAll), ConnectionString);
            tempSqlDataAdapter5.Fill(dsCategory2, "Category2");
            tempSqlDataAdapter5.Dispose();

            m_oDepositUsed = new CDepositUsed();
            m_oDeposit = new CDeposit();
            m_iOrderID = inOrderID;

            m_dTotalAmount = inTotalAmount;
            membershipdiscount = inMembershipdiscount;

            m_dBalance = inTotalAmount + Convert.ToDouble("0" + serviceCharge);
            m_sTableType = inTableType;
            m_dtItemList = inItemList;
            m_iDrinksIndex = drinksIndex;
            m_dServiceAmount = Convert.ToDouble("0" + serviceCharge);

            g_BalaceLabel.Text = String.Format("Balace Due {0}" + (inTotalAmount + Convert.ToDouble("0" + serviceCharge)).ToString("F02"), Program.currency);
            g_BillTotalLabel.Text = Program.currency + m_dBalance.ToString("F02");
            m_tobePaid = inTotalAmount; //Total without service charge

            g_DiscountLabel.Text = Program.currency + inDiscount.ToString();
            g_ServiceChargeLabel.Text = Program.currency + Convert.ToDouble("0" + serviceCharge).ToString("F02");
            membershipdiscountlabel.Text = Program.currency + inMembershipdiscount.ToString();

            // double grand = m_dTotalAmount + Convert.ToDouble(inDiscount);

            //Vat Claculation
            DataTable dt = inItemList;
            for (int i = 0; i < dt.Rows.Count;i++ )
            {
                vatTotalAmount += Convert.ToDouble( dt.Rows[i]["Vat"].ToString());
            }
            lblVat.Text = Program.currency + vatTotalAmount.ToString("F02");

            //   vatTotalAmount = ((m_dTotalAmount + Convert.ToDouble(inDiscount)) * (vat / 100)) / (1 + (vat / 100));
              //  lblVat.Text = Program.currency + vatTotalAmount.ToString("F02");

            //String CashButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Cash'")[0]["color"].ToString();
            //g_CashButton.BackColor = Color.FromArgb(Int32.Parse(CashButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(CashButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(CashButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String ChequeButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Cheque'")[0]["color"].ToString();
            //g_ChequeButton.BackColor = Color.FromArgb(Int32.Parse(ChequeButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(ChequeButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(ChequeButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String EFTButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'EFT'")[0]["color"].ToString();
            //g_EFTButton.BackColor = Color.FromArgb(Int32.Parse(EFTButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(EFTButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(EFTButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String VoucherButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Voucher'")[0]["color"].ToString();
            //g_VoucherButton.BackColor = Color.FromArgb(Int32.Parse(VoucherButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(VoucherButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(VoucherButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String AccountButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Account'")[0]["color"].ToString();
            //g_AccountButton.BackColor = Color.FromArgb(Int32.Parse(AccountButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(AccountButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(AccountButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String LoyaltiCardButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Loyalty Card'")[0]["color"].ToString();
            //g_LoyaltiCardButton.BackColor = Color.FromArgb(Int32.Parse(LoyaltiCardButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(LoyaltiCardButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(LoyaltiCardButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String DiscountColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Discount'")[0]["color"].ToString();
            //g_DiscountButton.BackColor = Color.FromArgb(Int32.Parse(DiscountColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(DiscountColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(DiscountColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            LoadPrintOffButton();
            LoadStatusBar(inOrderID);
        }
Exemple #10
0
        public CPaymentForm(Int64 inOrderID, Double inTotalAmount, String inTableType, DataTable inItemList, Double inDiscount, int drinksIndex, string serviceCharge)
        {
            InitializeComponent();

            m_cCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
            String ConnectionString = m_cCommonConstants.DBConnection;
            SqlDataAdapter daCategory3 = new SqlDataAdapter(SqlQueries.GetQuery(Query.Category3GetAll), ConnectionString);
            daCategory3.Fill(dsCategory3, "Category3");
            daCategory3.Dispose();

            SqlDataAdapter daCategory4 = new SqlDataAdapter(SqlQueries.GetQuery(Query.Category4GetAll), ConnectionString);
            daCategory4.Fill(dsCategory4, "Category4");
            daCategory4.Dispose();

            SqlDataAdapter tempSqlDataAdapter5 = new SqlDataAdapter(SqlQueries.GetQuery(Query.Category2GetAll), ConnectionString);
            tempSqlDataAdapter5.Fill(dsCategory2, "Category2");
            tempSqlDataAdapter5.Dispose();

            m_oDepositUsed = new CDepositUsed();
            m_oDeposit = new CDeposit();
            m_iOrderID = inOrderID;

            m_dTotalAmount = inTotalAmount;

            m_dBalance = inTotalAmount + Convert.ToDouble("0" + serviceCharge);
            m_sTableType = inTableType;
            m_dtItemList = inItemList;
            m_iDrinksIndex = drinksIndex;
            m_dServiceAmount = Convert.ToDouble("0" + serviceCharge);

            g_BalaceLabel.Text = String.Format("Balace Due {0}" + (inTotalAmount + Convert.ToDouble("0" + serviceCharge)).ToString("F02"), Program.currency);
            g_BillTotalLabel.Text = Program.currency + inTotalAmount.ToString("F02");
            m_tobePaid = inTotalAmount; //Total without service charge

            g_DiscountLabel.Text = Program.currency + inDiscount.ToString("F02");
            g_ServiceChargeLabel.Text = Program.currency + Convert.ToDouble("0" + serviceCharge).ToString("F02");

            //String CashButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Cash'")[0]["color"].ToString();
            //g_CashButton.BackColor = Color.FromArgb(Int32.Parse(CashButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(CashButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(CashButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String ChequeButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Cheque'")[0]["color"].ToString();
            //g_ChequeButton.BackColor = Color.FromArgb(Int32.Parse(ChequeButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(ChequeButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(ChequeButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String EFTButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'EFT'")[0]["color"].ToString();
            //g_EFTButton.BackColor = Color.FromArgb(Int32.Parse(EFTButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(EFTButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(EFTButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String VoucherButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Voucher'")[0]["color"].ToString();
            //g_VoucherButton.BackColor = Color.FromArgb(Int32.Parse(VoucherButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(VoucherButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(VoucherButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String AccountButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Account'")[0]["color"].ToString();
            //g_AccountButton.BackColor = Color.FromArgb(Int32.Parse(AccountButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(AccountButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(AccountButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String LoyaltiCardButtonColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Loyalty Card'")[0]["color"].ToString();
            //g_LoyaltiCardButton.BackColor = Color.FromArgb(Int32.Parse(LoyaltiCardButtonColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(LoyaltiCardButtonColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(LoyaltiCardButtonColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            //String DiscountColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Discount'")[0]["color"].ToString();
            //g_DiscountButton.BackColor = Color.FromArgb(Int32.Parse(DiscountColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(DiscountColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
            //        Int32.Parse(DiscountColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

            LoadPrintOffButton();
            LoadStatusBar(inOrderID);
        }
Exemple #11
0
        private void g_UseDepositButton_Click(object sender, EventArgs e)
        {
            CCalculatorForm tempCalculatorForm = new CCalculatorForm("Use Deposit", "Enter Deposit Serial Number");
            tempCalculatorForm.ShowDialog();

            if (CCalculatorForm.inputResult.Equals("Cancel") || CCalculatorForm.inputResult.Equals(""))
            {
                return;
            }
            Int64 tempDepositSerial = Int64.Parse(CCalculatorForm.inputResult);
            CDepositManager tempDepositManager = new CDepositManager();
            CDeposit tempDeposit = new CDeposit();
            CResult oResult = tempDepositManager.DepositGetByDepositID(tempDepositSerial);
            if (oResult.IsSuccess && oResult.Data != null)
            {
                tempDeposit = (CDeposit)oResult.Data;

                if (tempDeposit.DepositID != 0)
                {

                    CUseDepositForm tempUseDepositForm = new CUseDepositForm(tempDeposit);
                    DialogResult dResult = tempUseDepositForm.ShowDialog();
                    if (dResult.Equals(DialogResult.Cancel))
                        return;
                    else if (dResult.Equals(DialogResult.OK))
                    {
                        if (CUseDepositForm.usedAmount > m_dBalance)
                        {
                            tempDeposit.DepositBalance = tempDeposit.DepositBalance - m_dBalance;
                        }
                        else
                        {
                            tempDeposit.DepositBalance = tempDeposit.DepositBalance - CUseDepositForm.usedAmount;
                        }
                        m_oDeposit = tempDeposit;

                        if (CUseDepositForm.usedAmount > m_dBalance)
                        {
                            m_dTotalAmount = m_dTotalAmount - m_dBalance;
                        }
                        else
                        {
                            m_dTotalAmount = m_dTotalAmount - CUseDepositForm.usedAmount;
                        }
                        g_BillTotalLabel.Text = "£" + m_dTotalAmount.ToString("F02");

                        g_DepositUsedLabel.Text = "£" + CUseDepositForm.usedAmount.ToString("F02");
                        CurrentPaymentMethod = "Deposit";
                        UpdateCalculation(0);
                        g_UseDepositButton.Enabled = false;
                    }
                }
                else
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error", "Deposit Information not found!");
                    tempMessageBox.ShowDialog();
                }
            }
        }