Example #1
0
        private void btnadd_Click(object sender, EventArgs e)
        {
            ClientEntity cl = new ClientEntity();
            //Required Fields-- Name, Address, City, Village, Mobile No
            if (!FieldsEmpty())
            {
                MessageBox.Show("Fill All the Fields Properly.");
                return;
            }

            //Check Client does Not Exists Already on basis of Mobile No
            if (cl.ClientExistsByMobileNo(txtmobilenumber.Text,txtmobilenumber2.Text))
            {
                MessageBox.Show("Client Already exits with this Mobile No.");
                return;
            }

            //Check Mobile no does not contain alphabetical characters
            if (!checkOnlyNumbers(txtmobilenumber.Text))
            {
                MessageBox.Show("Mobile No.1 Field Can Only Contain Number");
                return;
            }
            if (!checkOnlyNumbers(txtmobilenumber.Text))
            {
                MessageBox.Show("Mobile No.2 Field Can Only Contain Number");
                return;
            }
            //Get Date
            string date = DateTime.Today.ToString();

            //Add Client
            //Check For Any Insertion Errors
            //If Error
                //Notify User
            //Else
                //Clear All Fields
            ClientEntity client = new ClientEntity(txtcustomername.Text, txtaddress.Text, txtcity.Text, txtvillage.Text,txtmobilenumber.Text,txtmobilenumber2.Text,txtemail.Text,txtfathername.Text, date);
            if (client.CreateClient())
            {
                MessageBox.Show("New Client Created.");
                ClearFields();
            }
            else
            {
                MessageBox.Show("Problem In Inserting Product.");
            }
        }
Example #2
0
 private bool checkClientExistence()
 {
     if (txt_client_id.Text == "" && txt_client_mobile.Text == "")
        {
        return false;
        }
        ClientEntity ce = new ClientEntity();
        if (txt_client_mobile.Text != "")
        {
        return ce.ClientExistsByMobileNo(txt_client_mobile.Text, txt_client_mobile.Text);
        }
        else
        {
        return ce.ClientExistsById(txt_client_id.Text);
        }
 }