Example #1
0
        private void LoadValues()
        {
            currBalTextBox.Clear();
            CashTextBox.Clear();
            BankTextBox.Clear();
            con.Open();
            cmd = new SqlCommand("SELECT Balance, Cash, Bank FROM SavingsAcct", con);
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                string balance = (dr["Balance"].ToString());
                currBalTextBox.AppendText(balance + ".00");
                string bank = (dr["Bank"].ToString());
                BankTextBox.AppendText(bank + ".00");
                string cash = (dr["Cash"].ToString());
                CashTextBox.AppendText(cash + ".00");
            }
            con.Close();
        }
Example #2
0
        private void OK_Button_Click(object sender, EventArgs e)
        {
            double temp;

            if (double.TryParse(CashTextBox.Text, out temp))
            {
                Payment = double.Parse(CashTextBox.Text);
                if (Payment >= TotalAmount)
                {
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                else
                {
                    CashTextBox.Focus();
                    CashTextBox.BackColor = Color.DeepPink;
                }
            }
            else
            {
                Payment = 0;
            }
        }
Example #3
0
 private void SaveForm_Load(object sender, EventArgs e)
 {
     BillAmount.Text = Amount.ToString("#,##0.00");
     //DiffAmount.Text = (0 - Amount).ToString("#,##0.00");
     CashTextBox.Select();
     dtdepos = new DataTable();
     dtdepos.Columns.Add(new DataColumn()
     {
         ColumnName = "DocNo", Caption = "เลขที่เอกสาร"
     });
     dtdepos.Columns.Add(new DataColumn()
     {
         ColumnName = "TotalAmount", Caption = "ยอดเงินมัดจำ"
     });
     //dpos.Columns.Add(new DataColumn() { ColumnName = "Amount",Caption="ยอดตัดจ่าย" });
     dtdepos.Columns.Add(new DataColumn()
     {
         ColumnName = "BillBalance", Caption = "ยอดคงเหลือ"
     });
     loadGrid();
     loadDeposit();
 }
Example #4
0
        public Savings()
        {
            string userName;

            InitializeComponent();

            depositCheckBox.Checked = true;

            con.Open();
            //Select's balance from table for preset
            cmd = new SqlCommand("SELECT Balance, Cash, Bank FROM SavingsAcct", con);
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                string balance = (dr["Balance"].ToString());
                currBalTextBox.AppendText(balance + ".00");
                beforeBalance = Convert.ToInt32(balance);
                string bank = (dr["Bank"].ToString());
                BankTextBox.AppendText(bank + ".00");
                string cash = (dr["Cash"].ToString());
                CashTextBox.AppendText(cash + ".00");
            }
            con.Close();

            //Gets userName from the Login page and determines if tabPage should be removed
            userName = Login.userName;
            if (userName != "nickrench3")
            {
                tabControl1.TabPages.Remove(tabPage2);
                tabControl1.TabPages.Remove(tabPage3);
            }
            //Gets the history from the EventLog
            GetHistory();

            //Get Last Updated Date
            GetLastUpdated();
        }
Example #5
0
 private void BindEvents()
 {
     //
     // txtCustomCode
     //
     txtCustomCode.LostFocus += (sender, args) => DressToNew.CustomCode = ((TextBox)sender).Text;
     //
     // txtBarCode
     //
     txtBarCode.LostFocus += (sender, args) => DressToNew.BarCode = ((TextBox)sender).Text;
     //
     // cmbType
     //
     cmbType.SelectedIndexChanged += (sender, args) =>
     {
         ComboBox   cmb  = (ComboBox)sender;
         RuleObject type = (RuleObject)cmb.SelectedItem;
         if (null == type)
         {
             DressToNew.TypeNo = null;
             Categories        = null;
         }
         else
         {
             DressToNew.TypeNo = type.RuleNo.ToString();
             Categories        = DressManager.FilterRules(Rules, type.RuleNo).ToList();
         }
     };
     //
     // cmbColor
     //
     cmbColor.LostFocus += (sender, args) => DressToNew.ColorName = ((ComboBox)sender).Text;
     //
     // cmbCategory
     //
     cmbCategory.SelectedIndexChanged += (sender, args) =>
     {
         ComboBox   cmb      = (ComboBox)sender;
         RuleObject category = (RuleObject)cmb.SelectedItem;
         DressToNew.CategoryNo = null == category ? null : category.RuleNo.ToString();
     };
     //
     // cmbBrand
     //
     cmbBrand.LostFocus += (sender, args) => DressToNew.BrandName = ((ComboBox)sender).Text;
     //
     // cmbOrnamental
     //
     cmbOrnamental.LostFocus += (sender, args) => DressToNew.OrnamentalName = ((ComboBox)sender).Text;
     //
     // cmbUpperStyle
     //
     cmbUpperStyle.LostFocus += (sender, args) => DressToNew.UpperStyleName = ((ComboBox)sender).Text;
     //
     // cmbLowerStyle
     //
     cmbLowerStyle.LostFocus += (sender, args) => DressToNew.LowerStyleName = ((ComboBox)sender).Text;
     //
     // cmbUpperMaterial
     //
     cmbUpperMaterial.LostFocus += (sender, args) => DressToNew.UpperMaterialName = ((ComboBox)sender).Text;
     //
     // cmbLowerMaterial
     //
     cmbLowerMaterial.LostFocus += (sender, args) => DressToNew.LowerMaterialName = ((ComboBox)sender).Text;
     //
     // cmbUse
     //
     cmbUse.LostFocus += (sender, args) => DressToNew.UseName = ((ComboBox)sender).Text;
     //
     // cmbSupplier
     //
     cmbSupplier.LostFocus += (sender, args) => DressToNew.SupplierName = ((ComboBox)sender).Text;
     //
     // cmbLevel
     //
     cmbLevel.LostFocus += (sender, args) =>
     {
         ComboBox cmb   = (ComboBox)sender;
         Level    level = (Level)cmb.SelectedItem;
         DressToNew.LevelNo = null == level ? null : level.No;
     };
     //
     // txtBuyer
     //
     txtBuyer.LostFocus += (sender, args) => DressToNew.SupplierName = ((TextBox)sender).Text;
     //
     // numUsedToday
     //
     numUsedToday.LostFocus += (sender, args) =>
     {
         NumericUpDown numric = (NumericUpDown)sender;
         DressToNew.NumOfUsedToday = string.IsNullOrWhiteSpace(numric.Text) ? 0 : Convert.ToInt32(numric.Value);
     };
     //
     // numNOTime
     //
     numNOTime.LostFocus += (sender, args) =>
     {
         NumericUpDown numric = (NumericUpDown)sender;
         DressToNew.NOTime = string.IsNullOrWhiteSpace(numric.Text) ? 0 : Convert.ToInt32(numric.Value);
     };
     //
     // txtCost
     //
     txtCost.LostFocus += (sender, args) =>
     {
         CashTextBox txt = (CashTextBox)sender;
         if (string.IsNullOrWhiteSpace(txt.Text))
         {
             DressToNew.CostPrice = decimal.Zero;
         }
         else
         {
             decimal cost;
             if (decimal.TryParse(txt.Text, out cost))
             {
                 DressToNew.CostPrice = cost;
             }
             else
             {
                 MessageBoxEx.Error(@"价格输入有误!");
                 txt.Highlight();
             }
         }
     };
     //
     // txtRent
     //
     txtRent.LostFocus += (sender, args) =>
     {
         CashTextBox txt = (CashTextBox)sender;
         if (string.IsNullOrWhiteSpace(txt.Text))
         {
             DressToNew.RentPrice = decimal.Zero;
         }
         else
         {
             decimal rent;
             if (decimal.TryParse(txt.Text, out rent))
             {
                 DressToNew.RentPrice = rent;
             }
             else
             {
                 MessageBoxEx.Error(@"价格输入有误!");
                 txt.Highlight();
             }
         }
     };
     //
     // txtSale
     //
     txtSale.LostFocus += (sender, args) =>
     {
         CashTextBox txt = (CashTextBox)sender;
         if (string.IsNullOrWhiteSpace(txt.Text))
         {
             DressToNew.SalePrice = decimal.Zero;
         }
         else
         {
             decimal sale;
             if (decimal.TryParse(txt.Text, out sale))
             {
                 DressToNew.SalePrice = sale;
             }
             else
             {
                 MessageBoxEx.Error(@"价格输入有误!");
                 txt.Highlight();
             }
         }
     };
     //
     // txtSource
     //
     txtSource.LostFocus += (sender, args) => DressToNew.Source = ((TextBox)sender).Text;
     //
     // txtDescription
     //
     txtDescription.LostFocus += (sender, args) => DressToNew.Description = ((TextBox)sender).Text;
     //
     // txtNote
     //
     txtNote.LostFocus += (sender, args) => DressToNew.Notes = ((TextBox)sender).Text;
     //
     // cmbServer
     //
     cmbServerPath.LostFocus += (sender, args) => ServerPath = ((ComboBox)sender).Text;
     //
     // photoPicker
     //
     photoPicker.PhotoFilePathChanged += (sender, args) => PhotoFilePath = ((SinglePhotoPicker)sender).PhotoFilePath;
 }
Example #6
0
 private void InitForm()
 {
     CashTextBox.Focus();
     CashTextBox.Select();
 }