public ActionResult Create(FIN_CashAdvanceModel model) { if (ModelState.IsValid) { var service = new RestServiceClient<FIN_CashAdvanceModel>(UserLogin); service.SetCookies(this.Request.Cookies, _hrm_Hr_Service); var result = service.Put(_hrm_Hr_Service, "api/FIN_CashAdvance/", model); } return View(); }
/// <summary> /// [Chuc.Nguyen] - Lấy dữ liệu bảng Tai Nạn(Hre_Accident) theo Id /// </summary> /// <param name="id"></param> /// <returns></returns> public FIN_CashAdvanceModel GetById(Guid id) { string status = string.Empty; var model = new FIN_CashAdvanceModel(); ActionService service = new ActionService(UserLogin); var entity = service.GetByIdUseStore<Fin_CashAdvanceEntity>(id, ConstantSql.hrm_hr_sp_get_CashAdvanceById, ref status); if (entity != null) { model = entity.CopyData<FIN_CashAdvanceModel>(); if(model.TravelRequestID != null) { model.IsTravelRequest = true; } if(!string.IsNullOrEmpty(model.Other)) { model.IsOther = true; } } model.ActionStatus = status; return model; }
public ActionResult ExportCashAdvanceByTemplate([DataSourceRequest] DataSourceRequest request, FIN_CashAdvanceSearchModel model) { string status = string.Empty; var isDataTable = false; object obj = new FIN_CashAdvanceItemModel(); var lstModel = new List<FIN_CashAdvanceItemModel>(); request.Page = 1; request.PageSize = int.MaxValue - 1; Guid[] Ids = null; if (!string.IsNullOrEmpty(model.ValueFields)) { Ids = model.ValueFields.Split(',').Select(s => Guid.Parse(s)).ToArray(); } var result = GetListData<FIN_CashAdvanceModel, Fin_CashAdvanceEntity, FIN_CashAdvanceSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_CashAdvance, ref status); //string _ProfileName=""; //string _PositionName=""; if (result != null) { //_ProfileName = result[0].ProfileName; //_PositionName = result[0].PositionName; var cashEntity = new FIN_CashAdvanceModel(); if (Ids != null) { cashEntity = result.Where(s => Ids.Contains(s.ID)).FirstOrDefault(); } var actionService = new ActionService(UserLogin); var objs = new List<object>(); if (cashEntity != null) { objs.Add(cashEntity.ID); lstModel = actionService.GetData<FIN_CashAdvanceItemModel>(objs, ConstantSql.hrm_hr_sp_get_CashAdvanceItemByCashAdvanceID, ref status); } //objs.Add(Common.DotNetToOracle(CashAdvanceID.ToString())); } //HeaderInfo headerInfo1 = new HeaderInfo() { Name = "ProfileName", Value = _ProfileName }; //HeaderInfo headerInfo2 = new HeaderInfo() { Name = "PositionName", Value = _PositionName }; //List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 }; if (model.IsCreateTemplateForDynamicGrid) { obj = lstModel; isDataTable = false; } if (model != null && model.IsCreateTemplate) { var path = Common.GetPath("Templates"); ExportService exportService = new ExportService(); ConfigExport cfgExport = new ConfigExport() { Object = obj, FileName = "FIN_CashAdvanceItemModel", OutPutPath = path, //HeaderInfo = listHeaderInfo, DownloadPath = Hrm_Main_Web + "Templates", IsDataTable = isDataTable }; var str = exportService.CreateTemplate(cfgExport); return Json(str); } if (model.ExportId != Guid.Empty) { var fullPath = ExportService.Export(model.ExportId, lstModel, null, model.ExportType); return Json(fullPath); } return Json(result.ToDataSourceResult(request)); }