/// <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; }
/// <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 CreateAndUpdateOrgMoreInfo(Guid? orgID, string servicesType, DateTime? contractFrom, DateTime? contractTo, string billingCompanyName, string billingAddress, string taxCode, string des, string durationPay, string recipientInvoice, string tetePhone, string cellPhone, string email) { var status = string.Empty; var message = string.Empty; var baseService = new BaseService(); var orgInfoServices = new Cat_OrgMoreInforServices(); var orgModel = new Cat_OrgMoreInforModel(); if (orgID != null) { var objs = new List<object>(); objs.Add(Common.DotNetToOracle(orgID.Value.ToString())); var orgInfoEntity = baseService.GetData<Cat_OrgMoreInforEntity>(objs, ConstantSql.hrm_hr_sp_get_OrgMoreInfoByOrgID, UserLogin, ref status).FirstOrDefault(); if (orgInfoEntity != null) { orgInfoEntity.ServicesType = servicesType; orgInfoEntity.ContractFrom = contractFrom; orgInfoEntity.ContractTo = contractTo; orgInfoEntity.BillingCompanyName = billingCompanyName; orgInfoEntity.BillingAddress = billingAddress; orgInfoEntity.TaxCode = taxCode; orgInfoEntity.Description = des; orgInfoEntity.DurationPay = durationPay; orgInfoEntity.RecipientInvoice = recipientInvoice; orgInfoEntity.TelePhone = tetePhone; orgInfoEntity.CellPhone = cellPhone; orgInfoEntity.Email = email; orgInfoEntity.OrgStructureID = orgID; message = orgInfoServices.Edit(orgInfoEntity); orgModel = orgInfoEntity.CopyData<Cat_OrgMoreInforModel>(); orgModel.ActionStatus = message; } else { var orgInfoAddEntity = new Cat_OrgMoreInforEntity(); orgInfoAddEntity.ServicesType = servicesType; orgInfoAddEntity.ContractFrom = contractFrom; orgInfoAddEntity.ContractTo = contractTo; orgInfoAddEntity.BillingCompanyName = billingCompanyName; orgInfoAddEntity.BillingAddress = billingAddress; orgInfoAddEntity.TaxCode = taxCode; orgInfoAddEntity.Description = des; orgInfoAddEntity.DurationPay = durationPay; orgInfoAddEntity.RecipientInvoice = recipientInvoice; orgInfoAddEntity.TelePhone = tetePhone; orgInfoAddEntity.CellPhone = cellPhone; orgInfoAddEntity.Email = email; orgInfoAddEntity.OrgStructureID = orgID; message = orgInfoServices.Add(orgInfoAddEntity); orgModel = orgInfoAddEntity.CopyData<Cat_OrgMoreInforModel>(); orgModel.ActionStatus = message; } } return Json(orgModel, JsonRequestBehavior.AllowGet); }