Esempio n. 1
0
        public ActionResult Updaterequest(M_WorkRequest data)
        {
            try
            {
                data.CreateID   = user.EmployeeNo;
                data.CreateDate = DateTime.Now;
                data.UpdateID   = user.EmployeeNo;
                data.UpdateDate = DateTime.Now;


                string Query = "";
                Query += "UPDATE [dbo].[M_WorkRequest] SET " +
                         "      [WorkrequestName] =  '" + data.WorkRequestName + "'" +
                         "      ,[UpdateID]=  '" + data.UpdateID + "'" +
                         "      ,[UpdateDate]=  '" + data.UpdateDate + "'" +
                         " WHERE [ID] =   '" + data.ID + "'";

                SqlCommand cmdSql = new SqlCommand();
                cmdSql.Connection     = conn;
                cmdSql.CommandTimeout = 0;
                cmdSql.CommandText    = Query;

                conn.Open();
                cmdSql.ExecuteNonQuery();
                conn.Close();

                return(Json(new { msg = "Success" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception err)
            {
                return(Json(new { msg = err.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 2
0
        public ActionResult Createrequest(M_WorkRequest data)
        {
            try
            {
                data.CreateID   = user.EmployeeNo;
                data.CreateDate = DateTime.Now;
                data.UpdateID   = user.EmployeeNo;
                data.UpdateDate = DateTime.Now;
                string Query = "";
                Query += "INSERT INTO [dbo].[M_WorkRequest]" +
                         "     ([WorkRequestName]" +
                         "     ,[IsDeleted]" +
                         "     ,[CreateID]" +
                         "     ,[CreateDate]" +
                         "     ,[UpdateID]" +
                         "     ,[UpdateDate])" +
                         "VALUES" +
                         "     ('" + data.WorkRequestName + "'," +
                         "     '" + 0 + "'," +
                         "     '" + data.CreateID + "'," +
                         "     '" + data.CreateDate + "'," +
                         "     '" + data.UpdateID + "'," +
                         "     '" + data.UpdateDate + "')";

                SqlCommand cmdSql = new SqlCommand();
                cmdSql.Connection     = conn;
                cmdSql.CommandTimeout = 0;
                cmdSql.CommandText    = Query;

                conn.Open();
                cmdSql.ExecuteNonQuery();
                conn.Close();

                return(Json(new { msg = "Success" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception err)
            {
                return(Json(new { msg = err.Message }, JsonRequestBehavior.AllowGet));
            }
        }