Example #1
0
        public void deleteemployee()
        {
            EmployeeClass ds = new EmployeeClass();

            ds.DeleteDetails(search.Text);
        }
Example #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            EmployeeClass db = new EmployeeClass();

            /*  Database db = new Database();
             * DataSet ds = db.dbse("SELECT comming_time,leave_time FROM attendance WHERE empid ='" + empid.Text + "'");
             * DataSet ds1 = db.dbse("SELECT rate_per_hour,rate_per_ot_hour,basic_salary FROM attendance WHERE empid ='" + empid.Text + "'");
             * DataSet ds2 = db.dbse("SELECT amount FROM loan WHERE empid ='" + empid.Text + "'");
             * if ()*/
            try
            {
                //string a = "1111";
                String qur1 = "SELECT basic_salary FROM emp_reg WHERE empid =" + txtempid.Text + "  ";
                // string qur1 = "SELECT * FROM emp_reg";
                //  +empid.Text +

                String qur2 = ("SELECT rate_per_hour FROM emp_reg WHERE empid ='" + txtempid.Text + "'  ");
                String b    = db.dbgett(qur1);
                //string b = "12";

                String b1 = db.dbgett(qur2);

                // int rate_per_hour = Convert.ToInt32(b1);

                //int basic_salary = Convert.ToInt32(b);
                var rate_per_hour = Int32.Parse(b1);
                var basic_salary  = Int32.Parse(b);



                String qur3 = ("SELECT rate_per_ot_hour FROM emp_reg WHERE empid ='" + txtempid.Text + "'  ");
                String b2   = db.dbgett(qur3);
                String qur4 = ("SELECT amount FROM loan WHERE empid ='" + txtempid.Text + "'  ");
                String b3   = db.dbgett(qur4);
                // int rate_per_ot_hour = Convert.ToInt32(b2);
                // int amount = Convert.ToInt32(b3);
                var rate_per_ot_hour = Int32.Parse(b2);
                var amount           = Int32.Parse(b3);


                date = bunifuDatepicker1.Value.Date.ToString("yyyy-MM-dd");
                DateTime date1 = Convert.ToDateTime(date);

                date2 = bunifuDatepicker2.Value.Date.ToString("yyyy-MM-dd");
                DateTime date3 = Convert.ToDateTime(date2);
                // date = dateTimePicker1.Value.Date.ToString("YYYY-MM-DD");
                // date2 = dateTimePicker2.Value.Date.ToString("YYYY-MM-DD");

                String QU = (" SELECT SUM(work_time) FROM sal_work_hour WHERE date BETWEEN '" + date + "' AND '" + date2 + "'  AND empid = '" + txtempid.Text + "' ");

                // MessageBox.Show(QU);

                String b4  = db.dbgett(QU);
                String QU1 = (" SELECT SUM(ot_time) FROM sal_work_hour WHERE date BETWEEN '" + date + "' AND '" + date2 + "' AND empid = '" + txtempid.Text + "' ");

                String b5 = db.dbgett(QU1);
                // MessageBox.Show(b4);
                // MessageBox.Show(b5);
                int total_work_time = Convert.ToInt32(b4);
                int total_ot_time   = Convert.ToInt32(b5);
                // var total_work_time = Int32.Parse(b2);
                //var total_ot_time = Int32.Parse(b2);

                int allowences = Convert.ToInt32(allownces.Text);
                //if (total_work_time != 0)
                //{
                if (allowences >= 0)
                {
                    var total_salary = (total_work_time * rate_per_hour) + (total_ot_time * rate_per_ot_hour) + basic_salary - amount + allowences;
                    label4.Text = "Total Salary is " + Convert.ToString(total_salary);
                    addsalaryDetails();

                    Tsalary = Convert.ToDouble(total_salary.ToString());
                }
                else
                {
                    MessageBox.Show("invalid allownces");
                }
                //}
            }
            catch (Exception ee)
            {
                MessageBox.Show("error" + ee);
            }
        }
Example #3
0
        public void updateemployee()
        {
            EmployeeClass ds = new EmployeeClass();

            ds.UpdateDetails(fname.Text, cardid.Text, lname.Text, address1.Text, Telephone.Text, position.Text, dob.Text, gender.Text, search.Text);
        }