예제 #1
0
 public JsonResult Service_WH_GetEmpWHById(int id)
 {
     try
     {
         TaskHourEmpViewModel model = dal.Get_EmpRecordById(id);
         return(Json(model, JsonRequestBehavior.AllowGet));
     }
     catch { return(null); }
 }
예제 #2
0
        public string Chk_EmpWHRecords(TaskHoursEmp model)
        {
            string res = string.Empty;

            if (model.StartTime > DateTime.Now || model.EndTime > DateTime.Now)
            {
                res = "开始or结束时间 不能超过当前时间!";
            }
            else
            {
                string         procName = "Proc_WHEmp_ChkEmpWHRecord";
                string         tName    = "WHRecordA";
                SqlParameter[] prams    =
                {
                    db.MakeInParam("@Id",      SqlDbType.Int,      100, model.Id),
                    db.MakeInParam("@STime",   SqlDbType.DateTime, 100, model.StartTime),
                    db.MakeInParam("@ETime",   SqlDbType.DateTime, 100, model.EndTime),
                    db.MakeInParam("@EmpCode", SqlDbType.NVarChar, 100, model.EmpCode),
                };
                DataTable dt = db.RunProcReturn(procName, prams, tName).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    int ChkFlag = Convert.ToInt32(dt.Rows[0]["ChkFlag"]);
                    if (ChkFlag == 1)
                    {
                        res = "当前用户存在未分配结束的任务工时——\r\n";
                        for (var i = 0; i < dt.Rows.Count; i++)
                        {
                            var taskTypeName = dt.Rows[i]["TaskTypeName"].ToString();
                            var taskName     = dt.Rows[i]["TaskName"].ToString();
                            res = res + taskTypeName + ":" + taskName + ";\r\n";
                        }
                    }
                    else
                    {
                        res = "当前用户以下时间段工时与本次记录冲突——\r\n";
                        foreach (DataRow row in dt.Rows)
                        {
                            TaskHourEmpViewModel dbEntry = DtToList.FillModel <TaskHourEmpViewModel>(row);
                            res = res + dbEntry.StartTime + "~" + dbEntry.EndTime + ";\r\n";
                        }
                    }
                }
            }
            return(res);
        }
예제 #3
0
        public TaskHourEmpViewModel Get_EmpRecordById(int id)
        {
            string procName = "Proc_WHEmp_GetRecordById";
            string tName    = "WHRecordA";

            SqlParameter[] prams =
            {
                db.MakeInParam("@Id", SqlDbType.Int, 100, id),
            };
            DataTable dt = db.RunProcReturn(procName, prams, tName).Tables[0];

            if (dt.Rows.Count > 0)
            {
                TaskHourEmpViewModel dbEntry = DtToList.FillModel <TaskHourEmpViewModel>(dt.Rows[0]);
                return(dbEntry);
            }
            return(new TaskHourEmpViewModel());
        }
예제 #4
0
 /// <summary>
 /// 审核工时
 /// </summary>
 /// <param name="ids"></param>
 public void Service_WH_ApproEmpWHRecord(string ids, int type)
 {
     if (!string.IsNullOrEmpty(ids))
     {
         var idArry = ids.Split(',');
         foreach (var _id in idArry)
         {
             int _intid = Convert.ToInt32(_id);
             TaskHourEmpViewModel dbEntry = dal.Get_EmpRecordById(_intid);
             if (new List <int> {
                 5
             }.Contains(dbEntry.INTStatus))
             {
                 Service_WH_UptEmpRecordState(type, _intid);
             }
         }
     }
 }