private void BillStoveRegulator_Load(object sender, EventArgs e)
        {
            Location = new Point(-7, 50);
            int w = SystemInformation.VirtualScreen.Width + 14;
            int h = SystemInformation.VirtualScreen.Height - 43;

            Size = new Size(w, h);
            dataGridView1.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10);
            dataGridView2.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10);
            dataGridView3.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10);
            using (StockMgntRef.StockMgntClient client = new StockMgntRef.StockMgntClient())
            {
                stoves = client.GetStoves().ToList();
                List <StockMgntRef.Stove> stoveTypes = stoves.Where(x => x.Price != 0).Select(x => x).ToList();
                dataGridView2.DataSource = stoveTypes;
            }
            using (CustomerMgntRef.CustomerMgntClient client1 = new CustomerMgntRef.CustomerMgntClient())
            {
                customersNames = client1.GetCustomersName();
                AutoCompleteStringCollection acsc = new AutoCompleteStringCollection();
                acsc.AddRange(customersNames);
                textBox1.AutoCompleteMode         = AutoCompleteMode.Suggest;
                textBox1.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                textBox1.AutoCompleteCustomSource = acsc;
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string temp = textBox1.Text;

            for (int i = 0; i < customersNames.Length; i++)
            {
                if (customersNames[i].Equals(temp))
                {
                    selectedCname   = customersNames[i];
                    button2.Enabled = true;
                    break;
                }
            }
            button2.Visible = true;
            using (CustomerMgntRef.CustomerMgntClient client = new CustomerMgntRef.CustomerMgntClient())
            {
                customer = client.GetCustomer(selectedCname);
                cid      = customer.CustomerId;
            }
            textBox12.Text = customer.Gender;
            textBox2.Text  = customer.CustomerName;
            textBox16.Text = customer.CustomerType;
            textBox3.Text  = customer.AadharNo;
            textBox14.Text = customer.RashanCardNo;
            textBox13.Text = customer.Address;
            textBox4.Text  = customer.City;
            textBox15.Text = customer.PinNo.ToString();
            textBox5.Text  = customer.Taluka;
            textBox6.Text  = customer.District;
            textBox7.Text  = customer.State;
            textBox8.Text  = customer.ContactNo;
            textBox9.Text  = customer.Email;
            textBox10.Text = customer.BankIFSC;
            textBox11.Text = customer.BankAccountNo;
        }
        /*protected override void WndProc(ref Message message)
         * {
         *  const int WM_SYSCOMMAND = 0x0112;
         *  const int SC_MOVE = 0xF010;
         *
         *  switch (message.Msg)
         *  {
         *      case WM_SYSCOMMAND:
         *          int command = message.WParam.ToInt32() & 0xfff0;
         *          if (command == SC_MOVE)
         *              return;
         *          break;
         *  }
         *
         *  base.WndProc(ref message);
         * }*/

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != null)
            {
                string value      = "";
                bool   isChecked1 = radioButton1.Checked;
                bool   isChecked2 = radioButton2.Checked;
                bool   isChecked3 = radioButton3.Checked;
                if (isChecked1)
                {
                    value = radioButton1.Text;
                }
                else if (isChecked2)
                {
                    value = radioButton2.Text;
                }
                else if (isChecked3)
                {
                    value = radioButton3.Text;
                }

                CustomerMgntRef.Customer c = new CustomerMgntRef.Customer();

                //c.CustomerId = 2;
                c.DistributorCode = 292029;
                c.CustomerName    = textBox1.Text + " " + textBox2.Text + " " + textBox12.Text;
                c.CustomerType    = comboBox1.Text;
                c.AadharNo        = textBox3.Text;
                c.RashanCardNo    = textBox14.Text;
                c.Gender          = value;
                c.City            = textBox4.Text;
                c.PinNo           = int.Parse(textBox15.Text);
                c.Taluka          = textBox5.Text;
                c.District        = textBox6.Text;
                c.State           = textBox7.Text;
                c.ContactNo       = textBox8.Text;
                c.Email           = textBox9.Text;
                c.BankIFSC        = textBox10.Text;
                c.BankAccountNo   = textBox11.Text;
                c.Address         = textBox13.Text;

                using (CustomerMgntRef.CustomerMgntClient client = new CustomerMgntRef.CustomerMgntClient())
                {
                    CustomerMgntRef.Customer customer = client.AddCustomer(c);
                    int id = customer.CustomerId;
                    PrintNewCustomerReciept(customer);
                    MessageBox.Show("Success Fully Created New Customer!! Customer Id is: " + id + " Please, Note this Id for future customer interactions.");
                }
            }
            else
            {
                MessageBox.Show("Fild must be filled!!");
            }
        }
        private void AddNewCustomer_Load(object sender, EventArgs e)
        {
            Location = new System.Drawing.Point(-7, 50);
            int w = SystemInformation.VirtualScreen.Width + 14;
            int h = SystemInformation.VirtualScreen.Height - 43;

            Size = new Size(w, h);
            using (CustomerMgntRef.CustomerMgntClient client = new CustomerMgntRef.CustomerMgntClient())
            {
                string[] installs = client.GetCustomersTypes().Distinct().ToArray();
                comboBox1.Items.AddRange(installs);
            }
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            string temp = textBox1.Text;

            for (int i = 0; i < customersNames.Length; i++)
            {
                if (customersNames[i].Equals(temp))
                {
                    selectedCname   = customersNames[i];
                    button2.Enabled = true;
                    break;
                }
            }
            if (selectedCname != null)
            {
                button2.Visible = true;
                using (CustomerMgntRef.CustomerMgntClient client = new CustomerMgntRef.CustomerMgntClient())
                {
                    customer = client.GetCustomer(selectedCname);
                    cid      = customer.CustomerId;
                }
                if (customer != null && customer.CustomerType.Equals("Industrial"))
                {
                    label2.Visible    = true;
                    textBox17.Visible = true;
                }
                textBox2.Text  = customer.CustomerName;
                textBox12.Text = customer.Gender;
                textBox16.Text = customer.CustomerType;
                textBox3.Text  = customer.AadharNo;
                textBox14.Text = customer.RashanCardNo;
                textBox13.Text = customer.Address;
                textBox4.Text  = customer.City;
                textBox15.Text = customer.PinNo.ToString();
                textBox5.Text  = customer.Taluka;
                textBox6.Text  = customer.District;
                textBox7.Text  = customer.State;
                textBox8.Text  = customer.ContactNo;
                textBox9.Text  = customer.Email;
                textBox10.Text = customer.BankIFSC;
                textBox11.Text = customer.BankAccountNo;
                TransactionMgnt.TransactionMgntClient client1 = new TransactionMgnt.TransactionMgntClient();
                List <TransactionMgnt.TxCylinder>     res     = client1.GetLastTxs(customer.CustomerId).ToList();
                dataGridView1.DataSource = res;
                if (res.FirstOrDefault().TxDate.ToShortDateString().Equals(DateTime.Now.ToShortDateString()))
                {
                    button2.Visible = false;
                }
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (cid > 0)
            {
                var confirmResult = MessageBox.Show("Are you sure to close this connection ??", "", MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.Yes)
                {
                    if (MessageBox.Show("About to close connection?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                    {
                        CustomerMgntRef.CustomerMgntClient client = new CustomerMgntRef.CustomerMgntClient();
                        var msg = client.DeleteCustomer(cid);
                        PrintCloseCustomerReciept(customer);

                        MessageBox.Show("Connection is Closed Successfully!!!");

                        textBox12.Text = "";
                        textBox2.Text  = "";
                        textBox16.Text = "";
                        textBox3.Text  = "";
                        textBox14.Text = "";
                        textBox13.Text = "";
                        textBox4.Text  = "";
                        textBox15.Text = "";
                        textBox5.Text  = "";
                        textBox6.Text  = "";
                        textBox7.Text  = "";
                        textBox8.Text  = "";
                        textBox9.Text  = "";
                        textBox10.Text = "";
                        textBox11.Text = "";
                    }
                    else
                    {
                        // If 'Cancel', do something here.
                    }
                }
                else
                {
                    // If 'No', do something here.
                }
            }
            else
            {
                MessageBox.Show("Something went wrong!!!");
            }
        }
Ejemplo n.º 7
0
        private void BookCylinder_Load(object sender, EventArgs e)
        {
            Location = new Point(-7, 50);
            int w = SystemInformation.VirtualScreen.Width + 14;
            int h = SystemInformation.VirtualScreen.Height - 43;

            Size = new Size(w, h);
            CustomerMgntRef.CustomerMgntClient client = new CustomerMgntRef.CustomerMgntClient();
            customersNames = client.GetCustomersName();
            AutoCompleteStringCollection acsc = new AutoCompleteStringCollection();

            acsc.AddRange(customersNames);
            textBox1.AutoCompleteMode         = AutoCompleteMode.Suggest;
            textBox1.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            textBox1.AutoCompleteCustomSource = acsc;
            button2.Enabled = false;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != null)
            {
                string value      = "";
                bool   isChecked1 = radioButton1.Checked;
                bool   isChecked2 = radioButton2.Checked;
                bool   isChecked3 = radioButton3.Checked;
                if (isChecked1)
                {
                    value = radioButton1.Text;
                }
                else if (isChecked2)
                {
                    value = radioButton2.Text;
                }
                else if (isChecked3)
                {
                    value = radioButton3.Text;
                }

                customer.CustomerId        = this.customer.CustomerId;
                this.customer.CustomerName = textBox1.Text;
                customer.CustomerType      = textBox16.Text;
                customer.AadharNo          = textBox3.Text;
                customer.RashanCardNo      = textBox14.Text;
                customer.Gender            = value;
                customer.City          = textBox4.Text;
                customer.PinNo         = int.Parse(textBox15.Text);
                customer.Taluka        = textBox5.Text;
                customer.District      = textBox6.Text;
                customer.State         = textBox7.Text;
                customer.ContactNo     = textBox8.Text;
                customer.Email         = textBox9.Text;
                customer.BankIFSC      = textBox10.Text;
                customer.BankAccountNo = textBox11.Text;
                customer.Address       = textBox13.Text;

                using (CustomerMgntRef.CustomerMgntClient client = new CustomerMgntRef.CustomerMgntClient())
                {
                    var msg = client.UpdateCustomer(customer);
                    if (msg.Equals("OK"))
                    {
                        MessageBox.Show("Success Fully Upadted Customer Details!!");
                        textBox1.Text        = null;
                        textBox2.Text        = null;
                        textBox3.Text        = null;
                        textBox4.Text        = null;
                        textBox5.Text        = null;
                        textBox6.Text        = null;
                        textBox7.Text        = null;
                        textBox8.Text        = null;
                        textBox9.Text        = null;
                        textBox10.Text       = null;
                        textBox11.Text       = null;
                        textBox13.Text       = null;
                        textBox14.Text       = null;
                        textBox15.Text       = null;
                        radioButton1.Checked = false;
                        radioButton2.Checked = false;
                        radioButton3.Checked = false;
                    }
                    else
                    {
                        MessageBox.Show("Something went wrong!!!");
                    }
                    //PrintNewCustomerReciept(customer);
                }
            }
            else
            {
                MessageBox.Show("Fild must be filled!!");
            }
        }