예제 #1
0
파일: Customer.cs 프로젝트: bmujahid96/data
        private void Add()
        {
            if (string.IsNullOrWhiteSpace(txtcode.Text))
            {
                MessageBox.Show("Please Enter Code !!", "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtcode.Focus();
            }
            else if (string.IsNullOrWhiteSpace(txtname.Text))
            {
                MessageBox.Show("Please Enter Name !!", "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtname.Focus();
            }
            else if (string.IsNullOrWhiteSpace(txtmobileno.Text))
            {
                MessageBox.Show("Please Enter Mobile No !!", "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtmobileno.Focus();
            }

            else if (string.IsNullOrWhiteSpace(txtcity.Text))
            {
                MessageBox.Show("Please Enter City !!", "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtcity.Focus();
            }
            else
            {
                if (btnadd.Text == "&Add")
                {
                    string Query = "sp_tbcustomer_ups " + 0 + ",'" + txtcode.Text + "','" + txtname.Text + "','" + txtmobileno.Text + "','" + txtemailid.Text + "','" + txtaddress.Text + "','" + txtcity.Text + "','" + txtpincode.Text + "','Admin',1";
                    int    i     = customer.Add(Query);
                    if (i > 0)
                    {
                        MessageBox.Show("Data Successfull Saved !!", "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    Clearme();
                }
                else
                {
                    string Query = "sp_tbcustomer_ups " + CustomerId + ",'" + txtcode.Text + "','" + txtname.Text + "','" + txtmobileno.Text + "','" + txtemailid.Text + "','" + txtaddress.Text + "','" + txtcity.Text + "','" + txtpincode.Text + "','Admin',2";
                    int    i     = customer.Add(Query);
                    if (i > 0)
                    {
                        MessageBox.Show("Data Successfull Saved !!", "Demo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    Clearme();
                }
            }
        }