Beispiel #1
0
        /// <summary>
        /// [Son.Vo] - Lấy dữ liệu OrgStructure(Cat_OrgStructure) theo Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public CatOrgStructureModel GetById(Guid id)
        {
            string status = string.Empty;
            var model = new CatOrgStructureModel();

            var orgServices = new Cat_OrgMoreInforServices();
            ActionService service = new ActionService(UserLogin);
            var entity = service.GetByIdUseStore<Cat_OrgStructureEntity>(id,ConstantSql.hrm_cat_sp_get_OrgStructureById ,ref status);
            var objs = new List<object>();
            objs.Add(Common.DotNetToOracle(id.ToString()));
            var orgInfoEntity = orgServices.GetData<Cat_OrgMoreInforEntity>(objs, ConstantSql.hrm_hr_sp_get_OrgMoreInfoByOrgID, UserLogin, ref status).FirstOrDefault();
            if (entity != null)
            {

                model = entity.CopyData<CatOrgStructureModel>();
                if (orgInfoEntity != null)
                {
                    model.ServicesType = orgInfoEntity.ServicesType;
                    model.BillingAddress = orgInfoEntity.BillingAddress;
                    model.ContractFrom = orgInfoEntity.ContractFrom;
                    model.ContractTo = orgInfoEntity.ContractTo;
                    model.BillingCompanyName = orgInfoEntity.BillingCompanyName;
                    model.TaxCode = orgInfoEntity.TaxCode;
                    model.DescriptionInfo = orgInfoEntity.Description;
                    model.DurationPay = orgInfoEntity.DurationPay;
                    model.RecipientInvoice = orgInfoEntity.RecipientInvoice;
                    model.TelePhone = orgInfoEntity.TelePhone;
                    model.CellPhone = orgInfoEntity.CellPhone;
                    model.EmailInfo = orgInfoEntity.Email;
                    model.OrgMoreInforID = (Guid?)orgInfoEntity.ID;
                }
            }
            model.ActionStatus = status;
            return model;
        }
        public ActionResult Create(CatOrgStructureModel model)
        {

            if (ModelState.IsValid)
            {
                var service = new RestServiceClient<CatOrgStructureModel>(UserLogin);
                service.SetCookies(this.Request.Cookies, _Hrm_Hre_Service);
                var result = service.Put(_Hrm_Hre_Service, "api/CatOrgStructure/", model);

                ViewBag.MsgInsert = "Insert success";
            }
            return View();
        }
Beispiel #3
0
        public ActionResult GetReportOrgProfle([DataSourceRequest] DataSourceRequest request, CatOrgStructureModel Model)
        {
            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);
            List<object> listObj = new List<object>();
            List<Guid?> OrgIds = new List<Guid?>();
            string strOrgIDs = null;
            if (!string.IsNullOrEmpty(Model.OrgStructureID))
            {
                strOrgIDs = Model.OrgStructureID;
            }
            listObj.Add(strOrgIDs);
            string status = string.Empty;
            var result = actionServices.GetData<Cat_OrgStructureEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptOrgProfile, ref status).ToList().Translate<CatOrgStructureModel>();

            object obj = new CatOrgStructureModel();
            var isDataTable = false;
            if (Model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = true;
            }
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "CatOrgStructureModel",
                    OutPutPath = path,
                    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, result, Model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }