public JsonResult GetReportList() { JsonresultModel ResultModel = new JsonresultModel(); ResultModel.Result = "0"; try { List <ReportModel> ReportList = ModelFactory.GetReportList(LoginUserInfo.ProgramList); ResultModel.Result = "1"; ResultModel.Query = ReportList; } catch (Exception ex) { ResultModel.ErrorMsg = ex.Message; } catch { ResultModel.ErrorMsg = "系統發生錯誤"; } return(Json(ResultModel, JsonRequestBehavior.AllowGet)); }
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 GetAppVersion(string AppOS) { JsonresultModel ResultModel = new JsonresultModel(); AppVersionModel AppVersion = new AppVersionModel(); try { if (AppOS == "IOS") { //iphone AppVersion.AppOS = "IOS"; AppVersion.Version = ConfigurationManager.AppSettings["IOS_Version"]; AppVersion.Download = ConfigurationManager.AppSettings["IOS_Download"]; ResultModel.Result = "1"; ResultModel.Query = AppVersion; } else if (AppOS == "Android") { //android AppVersion.AppOS = "Android"; AppVersion.Version = GeneralModelFactory.getAPKVersion(Server.MapPath("/files/app.apk")); AppVersion.Download = ConfigurationManager.AppSettings["Android_Download"]; ResultModel.Result = "1"; ResultModel.Query = AppVersion; } else { ResultModel.Result = "0"; ResultModel.ErrorMsg = "查無AppOS"; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } } catch { ResultModel.Result = "0"; ResultModel.ErrorMsg = "系統發生錯誤"; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } 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 GetTempLogin(string EmpNo) { RegalBonModelFactory ModelFactory = new RegalBonModelFactory(); JsonresultModel ResultModel = new JsonresultModel(); ResultModel.Result = "0"; try { TempLoginModel TempLogin = ModelFactory.GetTempLogin(EmpNo, true); //**計算COUNTDOWN try { DateTime EndTime = DateTime.Parse(TempLogin.EndTime); TimeSpan ts = EndTime - DateTime.Now; int CountDown = ts.Seconds; if (CountDown <= 0) { CountDown = 0; } TempLogin.CountDown = CountDown; }catch { } ResultModel.Query = TempLogin; ResultModel.Result = "1"; } catch (Exception ex) { ResultModel.ErrorMsg = ex.Message; } catch { ResultModel.ErrorMsg = "系統發生錯誤"; } return(Json(ResultModel, JsonRequestBehavior.AllowGet)); }
public JsonResult GetEmpInfo(string EmpNo) { JsonresultModel ResultModel = new JsonresultModel(); EmpModelFactory Factory = new EmpModelFactory(); EmpModel Emp = null; try { ResultModel.Result = "1"; Emp = Factory.GetEmpData(EmpNo); ResultModel.Query = Emp; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ResultModel.Result = "0"; ResultModel.ErrorMsg = ex.Message; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetRG01ToExcel(ReportFormModel ReportForm) { //初始**** if (ReportForm.EmpNo == null) { ReportForm.EmpNo = ""; } if (ReportForm.Company == null) { ReportForm.Company = ""; } if (ReportForm.DepartMentNo == null) { ReportForm.DepartMentNo = ""; } if (ReportForm.EndDate == null) { ReportForm.EndDate = ""; } if (ReportForm.StartDate == null) { ReportForm.StartDate = ""; } JsonresultModel ResultModel = new JsonresultModel(); ResultModel.Result = "0"; try { DataTable AttendanceDT = null; // DateTime StartDate = DateTime.Parse(ReportForm.StartDate); // DateTime EndDate = DateTime.Parse(ReportForm.EndDate); string filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xlsx"; //SavePath=儲存路徑 string filenameStr = AppDomain.CurrentDomain.BaseDirectory.ToString() + "Download\\" + filename; using (MemoryStream msExcel = ModelFactory.RG01ToExcel(ReportForm) as MemoryStream)// 新增試算表 { byte[] data = msExcel.ToArray(); using (FileStream fileStream = new FileStream(filenameStr, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) { fileStream.Write(data, 0, data.Length); fileStream.Flush(); fileStream.Close(); } } //賦予報表位址 ExcelModel Excel = new ExcelModel(); Excel.Url = "../Download/" + filename; ResultModel.Result = "1"; ResultModel.Query = Excel; return(Json(ResultModel, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { 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)); } }