// // GET: /App/ /// <summary> /// 外出紀錄 /// </summary> /// <param name="EmpNo"></param> /// <param name="SDATE"></param> /// <param name="EDATE"></param> /// <returns></returns> public JsonResult Outgoing(string EmpNo, string SDATE, string EDATE) { OutgoingModelFactory ModelFactory = new OutgoingModelFactory(); List <OutgoingEventModel> M = ModelFactory.GetEventList(EmpNo, SDATE, EDATE); return(Json(M, JsonRequestBehavior.AllowGet)); }
public OutgoingController() { if (ModelFactory == null) { ModelFactory = new OutgoingModelFactory(); } }
public JsonResult EditOutgoing(AppOutgoingModel AppOutgoing) { JsonresultModel ResultModel = new JsonresultModel(); try { CheckOutDatetime(AppOutgoing.SDate, AppOutgoing.STime); CheckOutDatetime(AppOutgoing.SDate, AppOutgoing.GoOutTime); OutgoingEventModel Outgoing = new OutgoingEventModel(); OutgoingModelFactory ModelFactory = new OutgoingModelFactory(); EmpModel EMP = ModelFactory.GetOutMan(AppOutgoing.OutMan); Outgoing.OutId = AppOutgoing.OutId; Outgoing.OutMan = EMP.EmployeeNo; Outgoing.Company = EMP.Company; Outgoing.RecordMan = EMP.EmployeeNo; Outgoing.Location = System.Web.HttpUtility.UrlDecode(AppOutgoing.Location); Outgoing.CustomerName = System.Web.HttpUtility.UrlDecode(AppOutgoing.CustomerName); Outgoing.OutDescription = ""; Outgoing.Status = "U";//編輯 Outgoing.OutDate = AppOutgoing.SDate.Replace("-", ""); Outgoing.OutTime = AppOutgoing.STime.Replace(":", ""); Outgoing.GoOutTime = AppOutgoing.GoOutTime.Replace(":", ""); Outgoing.Equipment = "1"; if (ModelFactory.EditOutgoing(Outgoing)) { ResultModel.Result = "1"; return(Json(ResultModel, JsonRequestBehavior.AllowGet));//代表已經處裡完 } else { ResultModel.Result = "0"; ResultModel.ErrorMsg = "編輯外出失敗"; return(Json(ResultModel, JsonRequestBehavior.AllowGet));//失敗 } } catch (Exception ex) { ResultModel.Result = "0"; ResultModel.ErrorMsg = ex.Message; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } catch { ResultModel.Result = "0"; ResultModel.ErrorMsg = "系統發生錯誤"; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } }
public JsonResult DeleteOutgoing(string OutId, string EmpNo) { OutgoingEventModel Outgoing = null; JsonresultModel ResultModel = new JsonresultModel(); try { Outgoing = new OutgoingEventModel(); Outgoing.OutId = OutId; Outgoing.OutMan = EmpNo; Outgoing.RecordMan = EmpNo; Outgoing.Status = "D"; //刪除 Outgoing.Equipment = "1"; //App OutgoingModelFactory ModelFactory = new OutgoingModelFactory(); if (ModelFactory.DeleteOutgoing(Outgoing)) { ResultModel.Result = "1"; return(Json(ResultModel, JsonRequestBehavior.AllowGet));//代表已經處裡完 } else { ResultModel.Result = "0"; ResultModel.ErrorMsg = "無法刪除外出記錄"; return(Json(ResultModel, JsonRequestBehavior.AllowGet));//失敗 } } catch (Exception ex) { ResultModel.Result = "0"; ResultModel.ErrorMsg = ex.Message; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } catch { ResultModel.Result = "0"; ResultModel.ErrorMsg = "系統發生錯誤"; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetCalendarAllList(string Company, string EmpNo, string SDATE, string EDATE) { OutgoingModelFactory ModelFactory = new OutgoingModelFactory(); List <OutgoingEventModel> Box = null; if (EmpNo == null || EmpNo == "") { //未登入-預設台北行事曆 Box = new List <OutgoingEventModel>(); Company = "TPE"; } else { Box = ModelFactory.GetEventList(EmpNo, SDATE, EDATE); } //將工作日寫入日歷中 MainModelFactory MainFactory = new MainModelFactory(); List <CalendarEventModel> HolidayList = new List <CalendarEventModel>(); HolidayList.AddRange(MainFactory.GetHolidayList(Company, SDATE, EDATE)); for (int i = 0; i < HolidayList.Count; i++) { OutgoingEventModel Cal = new OutgoingEventModel(); Cal.OutId = ""; Cal.id = HolidayList[i].id; Cal.title = HolidayList[i].title; Cal.start = HolidayList[i].start; Cal.allDay = true; Cal.self = true; Cal.backgroundColor = HolidayList[i].backgroundColor; Cal.color = HolidayList[i].color; Cal.textColor = HolidayList[i].textColor; Box.Add(Cal); } return(Json(Box, JsonRequestBehavior.AllowGet)); }
public JsonResult InsertOutgoing(AppOutgoingModel AppOutgoing) { JsonresultModel ResultModel = new JsonresultModel(); try { //檢查時間格式 是否正確 CheckOutDatetime(AppOutgoing.SDate, AppOutgoing.STime); CheckOutDatetime(AppOutgoing.SDate, AppOutgoing.GoOutTime); OutgoingFormModel OutgoingForm = new OutgoingFormModel(); List <OutgoingEventModel> OutgoingList = new List <OutgoingEventModel>(); //************************************ OutgoingForm.OutMan = AppOutgoing.OutMan; OutgoingForm.OutManCompany = AppOutgoing.OutManCompany; OutgoingForm.RecordMan = AppOutgoing.OutMan;//記錄人 等於 申請人 OutgoingForm.SDate = AppOutgoing.SDate; OutgoingForm.STime = AppOutgoing.STime; OutgoingForm.OutDescription = ""; OutgoingList.Add(new OutgoingEventModel() { Location = System.Web.HttpUtility.UrlDecode(AppOutgoing.Location), CustomerName = System.Web.HttpUtility.UrlDecode(AppOutgoing.CustomerName), OutDescription = System.Web.HttpUtility.UrlDecode(AppOutgoing.OutDescription), OutTime = OutgoingForm.STime.Replace(":", ""), GoOutTime = AppOutgoing.GoOutTime.Replace(":", ""), Equipment = "1", //App }); OutgoingForm.SDate = OutgoingForm.SDate.Replace("-", ""); OutgoingModelFactory ModelFactory = new OutgoingModelFactory(); if (ModelFactory.InsertOutgoing(OutgoingForm, OutgoingList, "A")) { ResultModel.Result = "1"; return(Json(ResultModel, JsonRequestBehavior.AllowGet));//代表已經處裡完 } else { ResultModel.Result = "0"; ResultModel.ErrorMsg = "新增外出失敗"; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { ResultModel.Result = "0"; ResultModel.ErrorMsg = ex.Message; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } catch { ResultModel.Result = "0"; ResultModel.ErrorMsg = "系統發生錯誤"; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } }