/// <summary> /// 修改公司组 /// </summary> /// <param name="company">当前公司Id</param> /// <param name="companyGroup">公司组Id</param> /// <param name="companyGroupView">公司组信息</param> /// <param name="operatorAccount">操作员账号</param> public static void UpdateCompanyGroup(Guid company, Guid companyGroup, CompanyGroupView companyGroupView, string operatorAccount) { var model = new CompanyGroup(companyGroup); model.Company = company; model.Description = companyGroupView.Description; model.Name = companyGroupView.Name; model.UpdateAccount = operatorAccount; model.UpdateTime = DateTime.Now; model.PurchaseMyPolicyOnly = companyGroupView.PurchaseMyPolicyOnly; if (companyGroupView.Limitations != null) { foreach (var item in companyGroupView.Limitations) { var limitationItem = new PurchaseLimitation(); limitationItem.Airlines = item.Airlines; limitationItem.DefaultRebateForNonePolicy = item.DefaultRebateForNonePolicy; limitationItem.Departures = item.Departures; limitationItem.PurchaseMyPolicyOnlyForNonePolicy = item.PurchaseMyPolicyOnlyForNonePolicy; model.AppendLimitaion(limitationItem); } } var reposity = Factory.CreateCompanyGroupRepository(); reposity.UpdateCompanyGroup(model); // 记录日志 var view = QueryCompanyGroup(companyGroup); string originalContent = string.Format("公司组Id:{0},组别名称:{1},组别描述:{2},是否采购其他代理政策:{3},公司Id:{4},限制信息集合:", companyGroup, view.Name, view.Description, view.PurchaseMyPolicyOnly, company); if (view.Limitations != null) { foreach (var item in companyGroupView.Limitations) { originalContent += string.Format("受限航空公司{0},限制出港城市{1},未发布政策时,是否只能采购自己的政策{2},未发布政策时,设置默认返点{3};", item.Airlines, item.Departures, item.PurchaseMyPolicyOnlyForNonePolicy, item.DefaultRebateForNonePolicy); } } string newContent = string.Format("公司组Id:{0},组别名称:{1},组别描述:{2},是否采购其他代理政策:{3},更新操作者账号:{4},更新时间:{5},公司Id:{6},限制信息集合:", model.Id, model.Name, model.Description, model.PurchaseMyPolicyOnly, model.UpdateAccount, model.UpdateTime.Value.Date.ToString("yyyy-MM-dd HH:mm:ss"), model.Company); if (companyGroupView.Limitations != null) { foreach (var item in companyGroupView.Limitations) { newContent += string.Format("受限航空公司{0},限制出港城市{1},未发布政策时,是否只能采购自己的政策{2},未发布政策时,设置默认返点{3};", item.Airlines, item.Departures, item.PurchaseMyPolicyOnlyForNonePolicy, item.DefaultRebateForNonePolicy); } } saveUpdateLog("公司组", originalContent, newContent, "公司Id:" + company.ToString() + "公司组Id:" + companyGroup.ToString(), operatorAccount); }
/// <summary> /// 添加公司组 /// </summary> /// <param name="company">当前公司Id</param> /// <param name="companyGroupView">公司组信息</param> /// <param name="operatorAccount">操作员账号</param> public static void RegisterCompanyGroup(Guid company, CompanyGroupView companyGroupView, string operatorAccount) { var model = new ChinaPay.B3B.Service.SystemSetting.Domain.CompanyGroup(); model.Name = companyGroupView.Name; model.PurchaseMyPolicyOnly = companyGroupView.PurchaseMyPolicyOnly; model.Description = companyGroupView.Description; model.Company = company; if (companyGroupView.Limitations != null) { foreach (var item in companyGroupView.Limitations) { var limitationItem = new PurchaseLimitation(); limitationItem.Airlines = item.Airlines; limitationItem.DefaultRebateForNonePolicy = item.DefaultRebateForNonePolicy; limitationItem.Departures = item.Departures; limitationItem.PurchaseMyPolicyOnlyForNonePolicy = item.PurchaseMyPolicyOnlyForNonePolicy; model.AppendLimitaion(limitationItem); } } model.RegisterAccount = operatorAccount; model.RegisterTime = DateTime.Now; var repository = Factory.CreateCompanyGroupRepository(); repository.RegisterCompanyGroup(model); string strContent = string.Format("公司组Id:{0},组别名称:{1},组别描述:{2},是否采购其他代理政策:{3},操作者账号:{4},创建时间:{5},公司Id:{6},受限航空公司集合:", model.Id, model.Name, model.Description, model.PurchaseMyPolicyOnly, model.RegisterAccount, model.RegisterTime.Date.ToString("yyyy-MM-dd HH:mm:ss"), model.Company); if (companyGroupView.Limitations != null) { foreach (var item in companyGroupView.Limitations) { strContent += string.Format("受限航空公司:{0},限制出港城市:{1},未发布政策时,是否只能采购自己的政策:{2},未发布政策时,设置默认返点:{3};", item.Airlines, item.Departures, item.PurchaseMyPolicyOnlyForNonePolicy, item.DefaultRebateForNonePolicy); } } saveAddLog("公司组", strContent, "公司Id:" + company.ToString() + "公司组Id:" + model.Id.ToString(), operatorAccount); }