public JsonResult SaveTimeUtilization(DyeingUtilityTimeUtilization timeUtilization)
        {
            var user = (User)Session["CurrentUser"];

            if (timeUtilization != null)
            {
                timeUtilization.UserID    = user.USERID;
                timeUtilization.TermID    = user.TermID;
                timeUtilization.EntryDate = DateTime.Now;
            }
            var res = _dyeingUtilityRepo.SaveTimeUtilization(timeUtilization);

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
        public DyeingUtilityTimeUtilization SaveTimeUtilization(DyeingUtilityTimeUtilization timeUtilization)
        {
            var res = new DyeingUtilityTimeUtilization();
            var dt  = new DataTable();

            try
            {
                dt             = InserOrUpdateTimeUtilization("SP_INSERT_DYEING_UTILITY_TIME_UTILIZATION", "SAVE_TIME_UTILIZATION", timeUtilization);
                res.SaveStatus = Operation.Success.ToString();
                res.ID         = Convert.ToInt32(dt.Rows[0]["ID"].ToString());
            }
            catch (Exception ex)
            {
                res.SaveStatus = ex.Message;
            }
            return(res);
        }
 public DataTable InserOrUpdateTimeUtilization(string procedure, string callname, DyeingUtilityTimeUtilization timeUtilization)
 {
     dbConn = new SqlConnection(connectionString);
     dbConn.Open();
     cmd             = new SqlCommand(procedure, dbConn);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add(new SqlParameter("@call_name", callname));
     cmd.Parameters.Add(new SqlParameter("@ID", timeUtilization.ID));
     cmd.Parameters.Add(new SqlParameter("@SetNo", timeUtilization.SetNo));
     cmd.Parameters.Add(new SqlParameter("@TimeUtilizationID", timeUtilization.TimeUtilizationID));
     cmd.Parameters.Add(new SqlParameter("@TimeUtilizationName", timeUtilization.TimeUtilizationName));
     cmd.Parameters.Add(new SqlParameter("@MCRunFrom", timeUtilization.MCRunFrom));
     cmd.Parameters.Add(new SqlParameter("@MCRunTo", timeUtilization.MCRunTo));
     cmd.Parameters.Add(new SqlParameter("@TotalTimeHour", timeUtilization.TotalTimeHour));
     cmd.Parameters.Add(new SqlParameter("@CalculatedRunHour", timeUtilization.CalculatedRunHour));
     cmd.Parameters.Add(new SqlParameter("@Remark", timeUtilization.Remark));
     cmd.Parameters.Add(new SqlParameter("@UserID", timeUtilization.UserID));
     cmd.Parameters.Add(new SqlParameter("@TermID", timeUtilization.TermID));
     cmd.Parameters.Add(new SqlParameter("@EntryDate", timeUtilization.EntryDate));
     da = new SqlDataAdapter(cmd);
     dt = new DataTable();
     da.Fill(dt);
     dbConn.Close();
     return(dt);
 }
Beispiel #4
0
 public DyeingUtilityTimeUtilization SaveTimeUtilization(DyeingUtilityTimeUtilization timeUtilization)
 {
     return(dataService.SaveTimeUtilization(timeUtilization));
 }