/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public Cat_OrgMoreInforModel GetById(Guid id) { string status = string.Empty; var model = new Cat_OrgMoreInforModel(); var service = new ActionService(UserLogin); var entity = service.GetByIdUseStore<Cat_OrgMoreInforEntity>(id, ConstantSql.hrm_cat_sp_get_OwnerByIds, ref status); if (entity != null) { model = entity.CopyData<Cat_OrgMoreInforModel>(); } 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); }