Esempio n. 1
0
 protected void btnReset_Click(object sender, EventArgs e)
 {
     Clear();
     v_cname.Text  = "";
     v_conper.Text = "";
     ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "showsupplier();", true);
     TBSupplierName.Focus();
 }
Esempio n. 2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                //bool phn = false;
                //bool email = false;
                //Regex regexobjphn = new Regex(@"^([0-9]*|\d*\.\d{1}?\d*)$");
                //Regex regexobjemail = new Regex(@"^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$");


                //if (TBSupplierName.Value == "")
                //{
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                //    lblalert.Text = "Please Write Supplier Name!!";
                //}

                //else if (TBPhoneNo.Value == "")
                //{
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                //    lblalert.Text = "Please Write Phone Num!!";
                //}

                //else if (TBMobile.Value == "")
                //{
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                //    lblalert.Text = "Please Write Cell No!!";
                //}
                //else if (TBDesignation.Value == "")
                //{
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                //    lblalert.Text = "Please Write Designation!!";
                //}
                //else if (TBNIC.Value == "")
                //{
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                //    lblalert.Text = "Please Write NIC!!";
                //}
                //else if (TBAddressOne.Value == "")
                //{
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                //    lblalert.Text = "Please Write Address!!";
                //}
                //else if (TBBusinessNature.Value == "")
                //{
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                //    lblalert.Text = "Please Write Business Nature!!";
                //}

                //else if (!regexobjphn.IsMatch(TBPhoneNo.Value))
                //{
                //    phn = false;
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                //    lblalert.Text = "Please Write Correct Phone Number!!";
                //}

                //else
                //{
                if (TBContactPerson.Value == "" || TBSupplierName.Value == "")
                {
                    if (TBSupplierName.Value == "")
                    {
                        v_conper.Text = "";
                        v_cname.Text  = "Please Company Name";
                        TBSupplierName.Focus();
                    }
                    else
                    {
                        v_conper.Text = "Please Contact Person";
                        v_cname.Text  = "";
                        TBContactPerson.Focus();
                    }
                }
                else if (TBPrevBal.Text == "")
                {
                    v_prebal.Text = "Please Write in Previous Balance...";
                }
                else
                {
                    if (HFSupplierID.Value == "")
                    {
                        v_cname.Text  = "";
                        v_conper.Text = "";
                        int a;
                        a = Save();

                        if (a == 1)
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                            lblalert.Text = "Supplier Has Been Saved!";
                            Clear();
                            FillGrid();
                        }
                    }
                    else if (HFSupplierID.Value != "")
                    {
                        int b;
                        b = update();

                        if (b == 1)
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                            lblalert.Text = "Supplier Has Been Updated!";
                            Clear();
                            FillGrid();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //   throw;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                lblalert.Text = ex.Message;
            }
        }