Esempio n. 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (lblEmpID.Text == "" && lblEmpName.Text == "")
                {
                    string display = "Please Select Emplyee From The List to Calculate Salary Breakups!";
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + display + "');", true);
                    Button2.Enabled = false;
                }


                string   myString = lblName.Text;
                ReadData r        = new ReadData();
                if (r.FindString(myString) == true)
                {
                    lblWhatHappened.ForeColor = System.Drawing.Color.Red;
                    lblWhatHappened.Text      = "Record Already Exists";
                    Button2.Enabled           = false;
                    Button3.Enabled           = false;
                }
                else
                {
                    lblWhatHappened.ForeColor = System.Drawing.Color.DarkGreen;
                    lblWhatHappened.Text      = "Available To Record!";
                    Button2.Enabled           = true;
                    Button3.Enabled           = true;
                    Button1.Enabled           = false;
                    Button2.Enabled           = true;
                    string empname    = lblName.Text;
                    string empno      = lblID.Text;
                    float  basic      = Convert.ToInt32(txtCalculateSalary.Text);
                    float  hra        = Convert.ToInt32(basic * 0.4);
                    float  da         = Convert.ToInt32(basic * 0.6);
                    float  gross      = Convert.ToInt32(basic + hra + da);
                    float  pf         = Convert.ToInt32(gross * 0.13);
                    float  tax        = Convert.ToInt32(gross * 0.2);
                    float  deductions = Convert.ToInt32(pf + tax);
                    float  netsalary  = Convert.ToInt32(gross - deductions);


                    lblEmpBasic.Text   = basic.ToString();;
                    lblHRA.Text        = hra.ToString();
                    lblDA.Text         = da.ToString();
                    lblGross.Text      = gross.ToString();
                    lblPF.Text         = pf.ToString();
                    lblTax.Text        = tax.ToString();
                    lblDeductions.Text = deductions.ToString();
                    lblTotal.Text      = netsalary.ToString();
                }
            }
            catch (SqlException myex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myex + "');", true);
                Button2.Enabled = false;
            }
        }
Esempio n. 2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            ReadData r = new ReadData();

            if (r.FindString(textBox1.Text))    //checking database if groupname already exits or not
            {
                MessageBox.Show("Name already exists ");
                textBox1.Focus();
                //textBox1.Text = null;
                // textBox2.Text = null;
            }
            else if (textBox1.Text.Length == 0)                  //group_name is null then return error message
            {
                MessageBox.Show("Please enter group name!");
                textBox1.Focus();
            }

            else if (button1.Text == "&Save")                                          //used to save group_name and des in db
            {
                string          Error   = "";
                DBProductMaster saveobj = new DBProductMaster();
                saveobj.savegroup(textBox1.Text, textBox2.Text, ref Error);
                if (Error != "")
                {
                    MessageBox.Show(Error);
                }
                else
                {
                    MessageBox.Show("Saved Sucessfully");
                    fillcombo1();
                    refresh();
                }
            }
            else if (button1.Text == "&Update")
            {
                string          Error     = "";
                DBProductMaster updateobj = new DBProductMaster();
                updateobj.updategroup(textBox1.Text, textBox2.Text, comboBox2.Text, ref Error);
                if (Error != "")
                {
                    MessageBox.Show(Error);
                }
                else
                {
                    MessageBox.Show("Updated Sucessfully");
                    refresh();
                }
                // refresh();
            }
        }
Esempio n. 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ReadData r = new ReadData();

            if (r.FindString(txtPercentage.Text))    //checking database if groupname already exits or not
            {
                MessageBox.Show("Name already exists ");
                txtPercentage.Focus();
            }
            else if (txtPercentage.Text.Length == 0)                  //group_name is null then return error message
            {
                MessageBox.Show("Please enter Tax!");
                txtPercentage.Focus();
            }

            else if (btnSave.Text == "&Save")                                          //used to save   and des in db
            {
                string          Error   = "";
                DBProductMaster saveobj = new DBProductMaster();
                saveobj.savetax(txtPercentage.Text, txtDesc.Text, ref Error);
                if (Error != "")
                {
                    MessageBox.Show(Error);
                }
                else
                {
                    MessageBox.Show("Saved Sucessfully");
                    fillcombo1();
                    refresh();
                }
            }
            else if (btnSave.Text == "&Update")
            {
                string          Error     = "";
                DBProductMaster updateobj = new DBProductMaster();
                updateobj.updatetax(txtPercentage.Text, txtDesc.Text, cmbAutono.Text, ref Error);
                if (Error != "")
                {
                    MessageBox.Show(Error);
                }
                else
                {
                    MessageBox.Show("Updated Sucessfully");
                    refresh();
                }
                // refresh();
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            ReadData r = new ReadData();

            if (r.FindString(textBox1.Text))    //checking database if groupname already exits or not
            {
                MessageBox.Show("Name already exists ");
                //textBox1.Text = null;
                // textBox2.Text = null;
            }

            else if (textBox1.Text.Length == 0)                     //group_name is null then return error message
            {
                MessageBox.Show("Please enter group name!");
            }

            else                                               //used to save group_name and des in db
            {
                save();
            }
        }
Esempio n. 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ReadData r = new ReadData();

            if (r.FindString(txtItemname.Text))     //checking database if groupname already exits or not
            {
                MessageBox.Show("Name already exists ");
            }

            else if (txtItemname.Text.Length == 0 || txtMinimumOrderQty.Text.Length == 0 || txtRate.Text.Length == 0 || txtReorderqty.Text.Length == 0 || txtSellingprice.Text.Length == 0)                  //group_name is null then return error message
            {
                MessageBox.Show("Please enter all fields!");
            }

            else                                           //used to save group_name and des in db
            {
                save();
                refresh();
                loadState();
            }
        }