Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            String Result = DatabaseCalls.AddCustomer(textBox1.Text, "None", "None", "None", 0, 0);

            CustomerName_txt.Items.Add(textBox1.Text);
            CustomerName_txt.Text = textBox1.Text;
            button1_Click(sender, e);
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (CustomerName_txt.Text != "" && CustomerNameSearch_txt.Items.Contains(CustomerName_txt.Text) == false)
            {
                try
                {
                    String   Result     = DatabaseCalls.AddCustomer(CustomerName_txt.Text, CustomerAddress_txt.Text, CustomerPhone_txt.Text, CustomerEmail_txt.Text, 0, Convert.ToInt32(CustomerOpeningBalance_txt.Text));
                    string[] CustomerID = Result.Split('=');
                    DatabaseCalls.AddBill(DatabaseCalls.GetNewBillNumber() + 1, Convert.ToInt32(CustomerID[1].Trim()), DateTime.Now, Convert.ToInt32(CustomerOpeningBalance_txt.Text), Convert.ToInt32(CustomerOpeningBalance_txt.Text), "Opening Balance");
                    Variables.NotificationStatus       = true;
                    Variables.NotificationMessageTitle = this.Name;
                    Variables.NotificationMessageText  = Result;
                    CustomerDataSet = DatabaseCalls.GetCustomers();
                    CustomersDataGridView.DataSource            = CustomerDataSet.Tables[0];
                    CustomersDataGridView.Columns["ID"].Visible = false;

                    foreach (DataRow GridViewColumn in CustomerDataSet.Tables[0].Rows)
                    {
                        CustomerNameSearch_txt.Items.Add(GridViewColumn.ItemArray[1]);
                    }
                }
                catch (Exception ex)
                {
                    Variables.NotificationStatus       = true;
                    Variables.NotificationMessageTitle = this.Name;
                    Variables.NotificationMessageText  = ex.Message;
                }
            }
            else
            {
                Variables.NotificationStatus       = true;
                Variables.NotificationMessageTitle = this.Name;
                Variables.NotificationMessageText  = "Customer Name already Exists...";
            }
            FormLoading = false;
            //this.Close();
        }