Esempio n. 1
0
        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));
            }
        }
Esempio n. 2
0
        public JsonResult EditOutgoing(string OutgoingJson)
        {
            OutgoingEventModel Outgoing = null;

            try
            {
                Outgoing = JsonConvert.DeserializeObject <OutgoingEventModel>(OutgoingJson);

                //檢查預約日期合不合法 , 若不合法 報錯!
                CheckOutDatetime(Outgoing.OutDate, Outgoing.OutTime);
                CheckOutDatetime(Outgoing.OutDate, Outgoing.GoOutTime);

                Outgoing.OutMan    = LoginUserInfo.UserId;
                Outgoing.RecordMan = LoginUserInfo.UserId;
                Outgoing.Company   = LoginUserInfo.Company;
                Outgoing.Status    = "U";//編輯
                Outgoing.OutDate   = Outgoing.OutDate.Replace("-", "");
                Outgoing.OutTime   = Outgoing.OutTime.Replace(":", "");
                Outgoing.GoOutTime = Outgoing.GoOutTime.Replace(":", "");

                Outgoing.OutDescription = "";



                if (ModelFactory.EditOutgoing(Outgoing))
                {
                    return(Json("1"));//代表已經處裡完
                }
                else
                {
                    return(Json("失敗!"));//失敗
                }
            }
            catch (Exception ex)
            {
                return(Json(ex.Message));
            }
            catch
            {
                return(Json("系統發生錯誤"));
            }
        }