コード例 #1
0
ファイル: FIN_ClaimController.cs プロジェクト: dtafe/vnr
        /// <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_ClaimModel GetById(Guid id)
        {
            string status = string.Empty;
            var model = new FIN_ClaimModel();
            ActionService service = new ActionService(UserLogin);
            var entity = service.GetByIdUseStore<FIN_ClaimEntity>(id, ConstantSql.hrm_hr_sp_get_ClaimById, ref status);
            if (entity != null)
            {
                model = entity.CopyData<FIN_ClaimModel>();
                if (!string.IsNullOrEmpty(model.Other))
                {
                    model.IsManufactureName = true;
                }
                else {
                    model.IsProfile = true;
                }

                if(model.IsCashAdvance != null && model.IsCashAdvance == false)
                {
                    model.IsNoneCashAdvance = true;
                }
                if (model.IsCashAdvance != null  && model.IsCashAdvance == true)
                {
                    model.IsNoneCashAdvance = false;
                }
                
                
                
            }
            model.ActionStatus = status;
            return model;
        }
コード例 #2
0
ファイル: FIN_ClaimController.cs プロジェクト: dtafe/vnr
        public ActionResult Create(FIN_ClaimModel model)
        {

            if (ModelState.IsValid)
            {
                var service = new RestServiceClient<FIN_ClaimModel>(UserLogin);
                service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
                var result = service.Put(_hrm_Hr_Service, "api/FIN_Claim/", model);
            }
            return View();
        }
コード例 #3
0
 /// <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_ClaimModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new FIN_ClaimModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetByIdUseStore<FIN_ClaimEntity>(id, ConstantSql.hrm_hr_sp_get_ClaimById, ref status);
     if (entity != null)
     {
         model = entity.CopyData<FIN_ClaimModel>();
     }
     model.ActionStatus = status;
     return model;
 }
コード例 #4
0
ファイル: Hre_GetDataController.cs プロジェクト: dtafe/vnr
        public ActionResult ExportClaimByTemplate([DataSourceRequest] DataSourceRequest request, FIN_ClaimSearchModel model)
        {
            string status = string.Empty;
            var isDataTable = false;
            object obj = new FIN_ClaimItemModel();
            var lstModel = new List<FIN_ClaimItemModel>();
            request.Page = 1;
            request.PageSize = int.MaxValue - 1;
            var result = GetListData<FIN_ClaimModel, FIN_ClaimEntity, FIN_ClaimSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_Claim, ref status);
            Guid[] Ids = null;

            if (!string.IsNullOrEmpty(model.ValueFields))
            {
                Ids = model.ValueFields.Split(',').Select(s => Guid.Parse(s)).ToArray();
            }
            //string _ProfileName = "";
            //string _PositionName = "";
            if (result != null)
            {
                //_ProfileName = result[0].ProfileName;
                //_PositionName = result[0].PositionName;
                var claimEntity = new FIN_ClaimModel();
                if (Ids != null)
                {
                    claimEntity = result.Where(s => Ids.Contains(s.ID)).FirstOrDefault();
                }

                var actionService = new ActionService(UserLogin);
                var objs = new List<object>();
                if (claimEntity != null)
                {
                    objs.Add(claimEntity.ID);
                    lstModel = actionService.GetData<FIN_ClaimItemModel>(objs, ConstantSql.hrm_hr_sp_get_ClaimItemByClaimID, ref status);
                }

            }
            //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_ClaimItemModel",
                    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));
        }