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 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)); } }