Exemple #1
0
        public ActionResult ExtractEmp()
        {
            int    Eno = int.Parse(Request.QueryString["E"]);
            EmpSal E   = DBClass.getEmp(Eno);

            return(View("Extract", E));
        }
        public bool UpdateSalary(EmpSal empSal)
        {
            SqlCommand    cmd      = new SqlCommand();
            sqlConnection obj_con  = new sqlConnection();
            int           noOfRows = 0;

            if (obj_con.con.State == ConnectionState.Closed)
            {
                obj_con.con.Open();
            }
            try
            {
                cmd.CommandText = "update_sal_info";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = obj_con.con;
                cmd.Parameters.AddWithValue("@id", empSal.Id);
                cmd.Parameters.AddWithValue("@basic", empSal.Basic);
                cmd.Parameters.AddWithValue("@hra", empSal.Hra);
                cmd.Parameters.AddWithValue("@ta", empSal.Ta);
                cmd.Parameters.AddWithValue("@sa", empSal.Sa);
                cmd.Parameters.AddWithValue("@total", empSal.Salary);
                noOfRows = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
            }
            finally
            {
                cmd.Dispose();
                obj_con.con.Close();
                obj_con.con.Dispose();
            }
            return(noOfRows > 0 ? true : false);
        }
Exemple #3
0
        public ActionResult BoundCtrl(EmpSal E)
        {
            string msg = DBClass.InsertEmp(E);

            ViewBag.msg = msg;
            return(View());
        }
Exemple #4
0
 public bool Put(EmpSal empSal)
 {
     if (ModelState.IsValid)
     {
         return(repository.UpdateSalary(empSal));
     }
     return(false);
 }
Exemple #5
0
        public ActionResult UnBoundCtrl1()
        {
            EmpSal S = new EmpSal();

            S.Empno  = int.Parse(Request.Form["txtEmpno"]);
            S.Ename  = Request.Form["txtEname"];
            S.Salary = int.Parse(Request.Form["txtSalary"]);
            string msg = DBClass.InsertEmp(S);

            ViewBag.msg = msg;
            return(View("UnBoundCtrl"));
        }
        public EmpSal GetSalaryById(int id)
        {
            SqlCommand    cmd     = new SqlCommand();
            sqlConnection obj_con = new sqlConnection();
            EmpSal        emp     = new EmpSal();

            if (obj_con.con.State == ConnectionState.Closed)
            {
                obj_con.con.Open();
            }
            try
            {
                cmd.CommandText = "select_sal_info";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = obj_con.con;
                cmd.Parameters.AddWithValue("@id", id);
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    emp.Id     = (int)dr[0];
                    emp.Basic  = (int)dr[1];
                    emp.Hra    = (int)dr[2];
                    emp.Ta     = (int)dr[3];
                    emp.Sa     = (int)dr[4];
                    emp.Salary = (int)dr[5];
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                cmd.Dispose();
                obj_con.con.Close();
                obj_con.con.Dispose();
            }
            return(emp);
        }
Exemple #7
0
        public ActionResult Extract()
        {
            EmpSal E = new EmpSal();

            return(View());
        }
Exemple #8
0
        public ActionResult BoundCtrl()
        {
            EmpSal E = new EmpSal();

            return(View(E));
        }