예제 #1
0
파일: frmPOS.cs 프로젝트: iMutex/EBusiness
        private void chkCash_CheckedChanged(object sender, EventArgs e)
        {
            if (Common.IsCashAddressRequired)
            {
                cbCustomer.Visible = !chkCash.Checked;
                lblNameCaption.Visible = !chkCash.Checked;
                lblCustomerName.Visible = !chkCash.Checked;
                lblAddress.Visible = !chkCash.Checked;
                lblAddressHeading.Visible = !chkCash.Checked;

                lblCashAddress.Visible = chkCash.Checked;
                txtCashAddress.Visible = chkCash.Checked;
                txtCashName.Visible = chkCash.Checked;
                txtCashName.Text = string.Empty;
                txtCashAddress.Text = string.Empty;
                lblCustomerBalance.Visible = !chkCash.Checked;
                if (chkCash.Checked)
                {
                    Customer customer = new Customer();
                    DataTable dtCustomer = customer.SelectCustomerByCode("CASH");
                    txtCashName.Focus();
                    if (dtCustomer != null && dtCustomer.Rows.Count > 0)
                    {
                        txtCashName.Text = Convert.ToString(dtCustomer.Rows[0]["CustomerName"]);
                        txtCashAddress.Text = Convert.ToString(dtCustomer.Rows[0]["Address"]);
                    }

                }

            }
        }
예제 #2
0
파일: frmPOS.cs 프로젝트: iMutex/EBusiness
        private void btnDone_Click(object sender, EventArgs e)
        {
            try
            {
                string Id = string.Empty;
                if (chkCash.Checked)
                {
                    Customer customer = new Customer();
                    DataTable dtCustomer = customer.SelectCustomerByCode("CASH");

                    if (dtCustomer != null && dtCustomer.Rows.Count > 0)
                    {
                        Id = Convert.ToString(dtCustomer.Rows[0]["CustomerId"]);
                        string balance = Convert.ToString(dtCustomer.Rows[0]["CustomerBalance"]);
                        customer.InsertUpdateCustomer(Id, "CASH", txtCashName.Text, string.Empty, txtCashAddress.Text, balance, "1", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
                    }
                    else
                    {
                        Id = "0";
                        if (customer.InsertUpdateCustomer(Id, "CASH", txtCashName.Text, string.Empty, txtCashAddress.Text, "0.00", "1", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty))
                        {
                            dtCustomer = customer.SelectCustomerByCode("CASH");
                            Id = Convert.ToString(dtCustomer.Rows[0]["CustomerId"]);
                        }
                    }
                }
                else if (cbCustomer.Text.ToLower() == "cash")
                {
                    MessageBox.Show("To make a cash sale, CASH checkbox must be checked.");
                    chkCash.Checked = true;
                    return;
                }
                Save(Id);
            }
            catch (Exception ex)
            {
                ExceptionLog.LogException(Modules.POS, "Save", ex, "POS Exception");
            }
        }