/// <summary> /// 删除供应商 /// </summary> /// <param name="paramSupplierList"></param> /// <returns></returns> public bool DeleteSupplier(List <MDLPIS_Supplier> paramSupplierList) { if (paramSupplierList == null || paramSupplierList.Count == 0) { //请选择要删除供应商 ResultMsg = MsgHelp.GetMsg(MsgCode.W_0006, new object[] { SystemTableEnums.Name.PIS_Supplier, SystemActionEnum.Name.DELETE }); return(false); } try { DBManager.BeginTransaction(DBCONFIG.Coeus); #region 除供应商 var deleteSupplierResult = _bll.DeleteByList <MDLPIS_Supplier, MDLPIS_Supplier>(paramSupplierList); if (!deleteSupplierResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); //删除[供应商]信息失败 ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.DELETE + SystemTableEnums.Name.PIS_Supplier }); return(false); } #endregion DBManager.CommitTransaction(DBCONFIG.Coeus); } catch (Exception ex) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.DELETE, ex.Message }); LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, MethodBase.GetCurrentMethod().ToString(), ex.Message, "", null); return(false); } //刷新供应商缓存 var resultSupplierList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsSupplier) as List <MDLPIS_Supplier>; if (resultSupplierList != null) { var newSupplierList = resultSupplierList; //待移除的供应商 List <MDLPIS_Supplier> removeSupplierList = new List <MDLPIS_Supplier>(); foreach (var loopSupplier in newSupplierList) { var deleteSupplier = paramSupplierList.FirstOrDefault(x => x.SUPP_ID == loopSupplier.SUPP_ID); if (deleteSupplier != null) { removeSupplierList.Add(loopSupplier); } } foreach (var loopSupplier in removeSupplierList) { newSupplierList.Remove(loopSupplier); } CacheDAX.Remove(CacheDAX.ConfigDataKey.AutoPartsSupplier); CacheDAX.Add(CacheDAX.ConfigDataKey.AutoPartsSupplier, newSupplierList, true); } return(true); }
/// <summary> /// 删除配件类别 /// </summary> /// <param name="paramAutoPartsTypeList"></param> /// <returns></returns> public bool DeleteAutoPartsType(List <MDLBS_AutoPartsType> paramAutoPartsTypeList) { if (paramAutoPartsTypeList == null || paramAutoPartsTypeList.Count == 0) { //请选择要删除的配件类别 ResultMsg = MsgHelp.GetMsg(MsgCode.W_0006, new object[] { SystemActionEnum.Name.DELETE + SystemTableEnums.Name.BS_AutoPartsType }); return(false); } try { DBManager.BeginTransaction(DBCONFIG.Coeus); #region 除配件类别 var deleteAutoPartsTypeResult = _bll.DeleteByList <MDLBS_AutoPartsType, MDLBS_AutoPartsType>(paramAutoPartsTypeList); if (!deleteAutoPartsTypeResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); //删除[配件类别]信息失败 ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.DELETE + SystemTableEnums.Name.BS_AutoPartsType }); return(false); } #endregion DBManager.CommitTransaction(DBCONFIG.Coeus); } catch (Exception ex) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.DELETE, ex.Message }); LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, MethodBase.GetCurrentMethod().ToString(), ex.Message, "", null); return(false); } //刷新配件类别缓存 var resultAutoPartsTypeList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsType) as List <MDLBS_AutoPartsType>; if (resultAutoPartsTypeList != null) { var newAutoPartsTypeList = resultAutoPartsTypeList; //待移除的类别名称 List <MDLBS_AutoPartsType> removeAutoPartsTypeList = new List <MDLBS_AutoPartsType>(); foreach (var loopAutoPartsType in newAutoPartsTypeList) { var deleteUser = paramAutoPartsTypeList.FirstOrDefault(x => x.APT_ID == loopAutoPartsType.APT_ID); if (deleteUser != null) { removeAutoPartsTypeList.Add(loopAutoPartsType); } } foreach (var loopAutoPartsType in removeAutoPartsTypeList) { newAutoPartsTypeList.Remove(loopAutoPartsType); } CacheDAX.Remove(CacheDAX.ConfigDataKey.AutoPartsType); CacheDAX.Add(CacheDAX.ConfigDataKey.AutoPartsType, newAutoPartsTypeList, true); } return(true); }
/// <summary> /// 初始化【详情】Tab内控件 /// </summary> private void InitializeDetailTabControls() { #region 初始化下拉框 //用户名 _userList = CacheDAX.Get(CacheDAX.ConfigDataKey.SystemUser) as List <MDLSM_User>; mcbUserName.DisplayMember = SystemTableColumnEnums.SM_User.Code.User_Name; mcbUserName.ValueMember = SystemTableColumnEnums.SM_User.Code.User_ID; mcbUserName.DataSource = _userList; #endregion //初始化用户菜单明细List _userMenuAuthoritiyList = new SkyCarBindingList <UserMenuAuthorityUIModel, MDLSM_UserMenuAuthority>(); //开始监控用户菜单明细List变化 _userMenuAuthoritiyList.StartMonitChanges(); //初始化用户菜单明细动作List _userActionAuthoritiyList = new SkyCarBindingList <UserActionAuthorityUIModel, MDLSM_UserActionAuthority>(); //开始监控用户菜单明细动作List变化 _userActionAuthoritiyList.StartMonitChanges(); //初始化用户作业授权List _userJobAuthoritiyList = new SkyCarBindingList <UserJobAuthorityUIModel, MDLSM_UserJobAuthority>(); //开始监控用户作业授权List变化 _userJobAuthoritiyList.StartMonitChanges(); //初始化树形控件 InitializeMenuActionTreeView(); InitializeUserJobTreeView(); }
/// <summary> /// 初始化【列表】Tab内控件 /// </summary> private void InitializeListTabControls() { #region 查询条件初始化 //第三方编码 txtWhere_SI_ThirdNo.Clear(); //原厂编码 txtWhere_SI_OEMNo.Clear(); //配件条码 txtWhere_SI_Barcode.Clear(); //配件名称 mcbWhere_SI_Name.Clear(); #endregion #region 初始化下拉框 //配件名称 _autoPartsNameList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsName) as List <MDLBS_AutoPartsName>; mcbWhere_SI_Name.DisplayMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_Name; mcbWhere_SI_Name.ValueMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_ID; mcbWhere_SI_Name.DataSource = _autoPartsNameList; #endregion #region grid初始化 _detailGridDS = new SkyCarBindingList <AutoPartsShareInventoryManagerUIModel, MDLPIS_ShareInventory>(); gdGrid.DataSource = _detailGridDS; gdGrid.DataBind(); _detailGridDS.StartMonitChanges(); #endregion }
/// <summary> /// 初始化【详情】Tab内控件 /// </summary> private void InitializeDetailTabControls() { #region 工具生成 //品牌 mcbVBIS_Brand.Clear(); //品牌拼音首字母 txtVBIS_BrandSpellCode.Clear(); //车系 mcbVBIS_Inspire.Clear(); //车系拼音首字母 txtVBIS_InspireSpellCode.Clear(); //车辆类型 cbVBIS_Model.Items.Clear(); //车型描述 txtVBIS_ModelDesc.Clear(); //有效 ckVBIS_IsValid.Checked = true; ckVBIS_IsValid.CheckState = CheckState.Checked; //创建人 txtVBIS_CreatedBy.Text = LoginInfoDAX.UserName; //创建时间 dtVBIS_CreatedTime.Value = BLLCom.GetCurStdDatetime(); //修改人 txtVBIS_UpdatedBy.Text = LoginInfoDAX.UserName; //修改时间 dtVBIS_UpdatedTime.Value = BLLCom.GetCurStdDatetime(); //品牌车系ID txtVBIS_ID.Clear(); //版本号 txtVBIS_VersionNo.Clear(); //给 品牌 设置焦点 lblVBIS_Brand.Focus(); #endregion #region 初始化下拉框 //品牌 _vehicleBrandList = CacheDAX.Get(CacheDAX.ConfigDataKey.VehicleBrand) as List <MDLBS_VehicleBrandInspireSumma>; mcbVBIS_Brand.DisplayMember = SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Brand; mcbVBIS_Brand.ValueMember = SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Brand; mcbVBIS_Brand.DataSource = _vehicleBrandList; //车系 _vehicleInspireList = CacheDAX.Get(CacheDAX.ConfigDataKey.VehicleBrandInspire) as List <MDLBS_VehicleBrandInspireSumma>; mcbVBIS_Inspire.DisplayMember = SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Inspire; mcbVBIS_Inspire.ValueMember = SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Inspire; if (_vehicleInspireList != null && !string.IsNullOrEmpty(mcbVBIS_Brand.SelectedValue)) { var curVehicleInspireList = _vehicleInspireList.Where(x => x.VBIS_Brand == mcbVBIS_Brand.SelectedValue).ToList(); mcbVBIS_Inspire.DataSource = curVehicleInspireList; } //车辆类型:从码表获取 _vehicleModelList = CodeTableHelp.GetEnumForComboBoxWithValueText(CodeType.VehicleModel); cbVBIS_Model.DisplayMember = SysConst.EN_TEXT; cbVBIS_Model.ValueMember = SysConst.Value; cbVBIS_Model.DataSource = _vehicleModelList; cbVBIS_Model.DataBind(); #endregion }
/// <summary> /// 初始化动作按钮 /// </summary> public void InitializeAction() { if (ToolBarActionAndNavigate.Toolbars.Exists(SysConst.EN_ACTION)) { foreach (var loopAction in ToolBarActionAndNavigate.Toolbars[SysConst.EN_ACTION].Tools) { SetActionVisiableAndEnable(loopAction.Key, false, false); } } #region 根据登录用户的权限设置动作按钮[是否可见]和[是否可用](SuperAdmin拥有所有权限,登录时候数据已处理) var cacheObj = CacheDAX.Get(CacheDAX.ConfigDataKey.SystemUserAuthority); if (cacheObj == null) { return; } //根据Form类型获取对应动作权限 _menuGroupActionList = new List <MenuGroupActionUIModel>( ((List <MenuGroupActionUIModel>)cacheObj).Where( x => x.MenuD_ClassFullName == this.GetType().FullName).ToList()); foreach (var loopAction in _menuGroupActionList) { SetActionVisiableAndEnable(loopAction.Act_Key, true, true); } #endregion }
/// <summary> /// 初始化【列表】Tab内控件 /// </summary> private void InitializeListTabControls() { #region 查询条件初始化 //配件名称 mcbWhere_STD_Name.Clear(); //条形码 txtWhere_STD_Barcode.Clear(); //给 配件名称 设置焦点 lblWhere_STD_Name.Focus(); #endregion #region 初始化下拉框 //配件名称 _autoPartsNameList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsName) as List <MDLBS_AutoPartsName>; mcbWhere_STD_Name.DisplayMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_Name; mcbWhere_STD_Name.ValueMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_ID; mcbWhere_STD_Name.DataSource = _autoPartsNameList; #endregion //清空Grid ListGridDS = new List <StocktakingTaskManagerDetailUIModel>(); gdGrid.DataSource = ListGridDS; gdGrid.DataBind(); }
/// <summary> /// 获取基本信息(组织信息,个人客户信息,单位客户信息等等) /// </summary> /// <typeparam name="D">结果Model类型</typeparam> /// <param name="paramTBModel">查询条件TBModel,基本信息对应的TBModel(其类型即系统缓存的Key)</param> /// <param name="paramIsGetInfoFromDBDirectly">是否直接从数据库中获取信息 /// <para>paramIsGetInfoFromDBDirectly=true,直接从数据库中取数据。</para> /// <para>paramIsGetInfoFromDBDirectly=false,先从缓存取数据,未取到的场合,再从数据库中取数据。</para> /// </param> /// <returns>结果ModelList</returns> public static List <D> GetBaseInfor <D>(object paramTBModel, bool paramIsGetInfoFromDBDirectly) { LogHelper.WriteBussLogStart(Trans.COM, LoginInfoDAX.UserName, System.Reflection.MethodBase.GetCurrentMethod().ToString(), "", "", null); //结果List List <D> resultList = new List <D>(); //非直接从数据库中获取信息 if (!paramIsGetInfoFromDBDirectly) { //根据TBModel类型从缓存获取信息 object obj = CacheDAX.Get(paramTBModel.GetType().FullName); if (obj != null) { resultList = obj as List <D>; return(resultList); } } //检查参数是否为TBModel if (!paramTBModel.GetType().FullName.Contains(SysConst.EN_TBMODEL)) { LogHelper.WriteBussLogEndNG(Trans.COM, LoginInfoDAX.UserName, System.Reflection.MethodBase.GetCurrentMethod().ToString(), "", "", null); return(resultList); } //根据TBModel对象,查询信息 _bllBase.QuerryForList <D>(paramTBModel, resultList); //将结果信息添加到缓存,已经存在则覆盖原来的信息 CacheDAX.Add(paramTBModel.GetType().FullName, resultList, true); LogHelper.WriteBussLogEndOK(Trans.COM, LoginInfoDAX.UserName, System.Reflection.MethodBase.GetCurrentMethod().ToString(), "", "", null); return(resultList); }
/// <summary> /// 初始化【列表】Tab内控件 /// </summary> private void InitializeListTabControls() { #region 查询条件初始化 //条形码 if (txtWhere_ITL_Barcode.Enabled) { txtWhere_ITL_Barcode.Clear(); } //配件名称 if (mcbWhere_ITL_Name.Enabled) { mcbWhere_ITL_Name.Clear(); } //异动类型 if (cbWhere_ITL_TransType.Enabled) { cbWhere_ITL_TransType.Clear(); } //异动时间 dtWhere_ITL_CreatedTimeStart.Value = DateTime.Now.AddMonths(-6); dtWhere_ITL_CreatedTimeEnd.Value = null; //给 条形码 设置焦点 lblWhere_ITL_Barcode.Focus(); #endregion #region Grid初始化 //清空Grid ListGridDS = new List <InventoryTransLogQueryUIModel>(); gdGrid.DataSource = ListGridDS; gdGrid.DataBind(); #endregion #region 初始化下拉框 //配件名称下拉框 _autoPartsNameList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsName) as List <MDLBS_AutoPartsName>; mcbWhere_ITL_Name.DisplayMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_Name; mcbWhere_ITL_Name.ValueMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_Name; mcbWhere_ITL_Name.DataSource = _autoPartsNameList; //异动类型 _inventoryTransTypeList = EnumDAX.GetEnumForComboBoxWithCodeText(EnumKey.InventoryTransType); cbWhere_ITL_TransType.DisplayMember = SysConst.EN_TEXT; cbWhere_ITL_TransType.ValueMember = SysConst.EN_Code; cbWhere_ITL_TransType.DataSource = _inventoryTransTypeList; cbWhere_ITL_TransType.DataBind(); #endregion }
/// <summary> /// 初始化【列表】Tab内控件 /// </summary> private void InitializeListTabControls() { #region 查询条件初始化 if (cbWhere_CustomerType.Enabled) { //客户类别 cbWhere_CustomerType.Items.Clear(); } if (mcbWhere_AutoFactoryName.Enabled) { //汽修商户名称 mcbWhere_AutoFactoryName.Clear(); } //客户名称 txtWhere_CustomerName.Clear(); lblWhere_CustomerName.Focus(); #endregion //清空Grid ListGridDS = new List <CustomerQueryUIModel>(); gdGrid.DataSource = ListGridDS; gdGrid.DataBind(); #region 初始化下拉框 if (cbWhere_CustomerType.Enabled) { //客户类型(普通客户、一般汽修商户、平台内汽修商) _customerTypeList = EnumDAX.GetEnumForComboBoxWithCodeText(EnumKey.CustomerType); cbWhere_CustomerType.DisplayMember = SysConst.EN_TEXT; cbWhere_CustomerType.ValueMember = SysConst.EN_Code; cbWhere_CustomerType.DataSource = _customerTypeList; cbWhere_CustomerType.DataBind(); } //汽修商户名称 _autoFactoryList = CacheDAX.Get(CacheDAX.ConfigDataKey.ARMerchant) as List <MDLPIS_AutoFactoryCustomer>; if (_autoFactoryList != null) { var autoFactoryList = _autoFactoryList.Where(x => x.AFC_IsPlatform == true).ToList(); mcbWhere_AutoFactoryName.DisplayMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Name; mcbWhere_AutoFactoryName.ValueMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Code; if (mcbWhere_AutoFactoryName.Enabled) { mcbWhere_AutoFactoryName.DataSource = autoFactoryList; } } #endregion }
/// <summary> /// 窗体加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmMaintainBrandPartsInfo_Load(object sender, EventArgs e) { //初始化控件 InitializeDetailTabControls(); #region 加载配件下拉列表 //配件名称 _autoPartsNameList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsName) as List <MDLBS_AutoPartsName>; mcbVTPI_AutoPartsName.DisplayMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_Name; mcbVTPI_AutoPartsName.ValueMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_Name; mcbVTPI_AutoPartsName.DataSource = _autoPartsNameList; #endregion #region 处理参数 if (_viewParameters != null) { //传入Model if (_viewParameters.ContainsKey(ComViewParamKey.DestModel.ToString())) { _brandPartsInfo = _viewParameters[ComViewParamKey.DestModel.ToString()] as VehicleThirdPartsInfoUIModel; if (_brandPartsInfo != null) { //第三方编码 txtVBPI_ThirdNo.Text = _brandPartsInfo.VTPI_ThirdNo; //配件名称 mcbVTPI_AutoPartsName.SelectedValue = _brandPartsInfo.VTPI_AutoPartsName; //配件品牌 txtVBPI_AutoPartsBrand.Text = _brandPartsInfo.VTPI_AutoPartsBrand; //备注 txtVBPI_Remark.Text = _brandPartsInfo.VTPI_Remark; } } //MaintainBrandPartsInfoFunc if (_viewParameters.ContainsKey(BSViewParamKey.MaintainBrandPartsInfo.ToString())) { var tempFunc = _viewParameters[BSViewParamKey.MaintainBrandPartsInfo.ToString()] as Func <VehicleThirdPartsInfoUIModel, bool>; if (tempFunc != null) { _maintainBrandPartsInfoFunc = tempFunc; } else { MessageBoxs.Show(Trans.BS, this.ToString(), "请传入Func<VehicleThirdPartsInfoUIModel, bool>,以便处理原厂件信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } #endregion }
/// <summary> /// 初始化【列表】Tab内控件 /// </summary> private void InitializeListTabControls() { #region 查询条件初始化 //仓库名称 mcbWhere_INV_WH_Name.Clear(); //配件名称 mcbWhere_INV_Name.Clear(); //原厂编码 txtWhere_INV_OEMNo.Clear(); //配件批次号 txtWhere_INV_BatchNo.Clear(); //第三方编码 txtWhere_INV_ThirdNo.Clear(); //车型代码 txtWhere_APA_VehicleModelCode.Clear(); //互换码 txtWhere_APA_ExchangeCode.Clear(); //组织id txtWhere_INV_Org_ID.Clear(); txtWhere_INV_Org_ID.Text = LoginInfoDAX.OrgID; //给 单号 设置焦点 lblWhere_SO_No.Focus(); #endregion //清空Grid ListGridDS = new List <InventoryToShareQueryUIModel>(); gdGrid.DataSource = ListGridDS; gdGrid.DataBind(); //设置Grid自适应列宽(根据单元格内容) gdGrid.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.VisibleRows); #region 初始化下拉框 //配件名称 _autoPartsNameList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsName) as List <MDLBS_AutoPartsName>; mcbWhere_INV_Name.DisplayMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_Name; mcbWhere_INV_Name.ValueMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_ID; mcbWhere_INV_Name.DataSource = _autoPartsNameList; //仓库 var allWarehouseList = CacheDAX.Get(CacheDAX.ConfigDataKey.Warehouse) as List <MDLPIS_Warehouse>; mcbWhere_INV_WH_Name.DisplayMember = SystemTableColumnEnums.PIS_Warehouse.Code.WH_Name; mcbWhere_INV_WH_Name.ValueMember = SystemTableColumnEnums.PIS_Warehouse.Code.WH_ID; if (allWarehouseList != null) { _warehouseList = allWarehouseList.Where(x => x.WH_Org_ID == txtWhere_INV_Org_ID.Text).ToList(); mcbWhere_INV_WH_Name.DataSource = _warehouseList; } #endregion }
/// <summary> /// 初始化【详情】Tab内控件 /// </summary> private void InitializeDetailTabControls() { #region 工具生成 //配置名称ID txtAPN_ID.Clear(); //配件名称 txtAPN_Name.Clear(); //配件别名 txtAPN_Alias.Clear(); //名称拼音简写 txtAPN_NameSpellCode.Clear(); //别名拼音简写 txtAPN_AliasSpellCode.Clear(); //配件类别ID mcbAPT_Name.Clear(); //呆滞天数 txtAPN_SlackDays.Clear(); //计量单位 txtAPN_UOM.Clear(); //固定计量单位 ckAPN_FixUOM.Checked = true; ckAPN_FixUOM.CheckState = CheckState.Checked; //有效 ckAPN_IsValid.Checked = true; ckAPN_IsValid.CheckState = CheckState.Checked; //创建人 txtAPN_CreatedBy.Text = LoginInfoDAX.UserName; //创建时间 dtAPN_CreatedTime.Value = BLLCom.GetCurStdDatetime(); //修改人 txtAPN_UpdatedBy.Text = LoginInfoDAX.UserName; //修改时间 dtAPN_UpdatedTime.Value = BLLCom.GetCurStdDatetime(); //版本号 txtAPN_VersionNo.Clear(); //给 配置名称 设置焦点 lblAPN_Name.Focus(); #endregion #region 初始化下拉框 //配件类别 _autoPartsTypeList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsType) as List <MDLBS_AutoPartsType>; mcbAPT_Name.DisplayMember = SystemTableColumnEnums.BS_AutoPartsType.Code.APT_Name; mcbAPT_Name.ValueMember = SystemTableColumnEnums.BS_AutoPartsType.Code.APT_ID; mcbAPT_Name.DataSource = _autoPartsTypeList; #endregion base.OrginalUIModel = null; }
/// <summary> /// 初始化【列表】Tab内控件 /// </summary> private void InitializeListTabControls() { #region 工具生成 #region 查询条件初始化 //单号 txtWhere_PFO_No.Clear(); //供应商名称 mcbWhere_PFO_SUPP_Name.Clear(); //来源类型名称 cbWhere_PFO_SourceTypeName.Items.Clear(); //单据状态名称 cbWhere_PFO_StatusName.Items.Clear(); //有效 ckWhere_PFO_IsValid.Checked = true; ckWhere_PFO_IsValid.CheckState = CheckState.Checked; //给 单号 设置焦点 lblWhere_PFO_No.Focus(); #endregion #region 初始化下拉框 //供应商 _supplierList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsSupplier) as List <MDLPIS_Supplier>; mcbWhere_PFO_SUPP_Name.DisplayMember = SystemTableColumnEnums.PIS_Supplier.Code.SUPP_Name; mcbWhere_PFO_SUPP_Name.ValueMember = SystemTableColumnEnums.PIS_Supplier.Code.SUPP_ID; mcbWhere_PFO_SUPP_Name.DataSource = _supplierList; #endregion SetToComboEditor(); #region Grid初始化 base.HeadGridDS = new BindingList <PurchaseForecastOrderQueryUIModel>(); gdGrid.DataSource = base.HeadGridDS; gdGrid.DataBind(); #endregion #endregion //给下拉框复制 }
/// <summary> /// 获取汽修商户相关信息 /// </summary> /// <param name="paramMerchantCode">汽修商客户编码</param> private bool GetARMerchantInfo(string paramMerchantCode) { if (string.IsNullOrEmpty(paramMerchantCode)) { //汽修商客户ID为空,汽修商户信息获取失败 MessageBoxs.Show(Trans.IS, this.ToString(), MsgHelp.GetMsg(MsgCode.E_0016, SystemTableColumnEnums.PIS_AutoFactoryCustomer.Name.AFC_ID, MsgParam.AUTOFACTORY + MsgParam.INFORMATION + MsgParam.GET), MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } //从缓存中获取汽修商户信息 List <MDLPIS_AutoFactoryCustomer> resultAutoFactoryCustomerList = CacheDAX.Get(CacheDAX.ConfigDataKey.ARMerchant) as List <MDLPIS_AutoFactoryCustomer>; if (resultAutoFactoryCustomerList == null) { //汽修商户信息获取失败 MessageBoxs.Show(Trans.IS, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0002, MsgParam.AUTOFACTORY + MsgParam.INFORMATION + MsgParam.GET), MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } //获取该汽修商Code string tempAutoFactoryCode = string.Empty; List <MDLPIS_AutoFactoryCustomer> tempAutoFactoryCustomerList = resultAutoFactoryCustomerList.Where(p => p.AFC_Code == paramMerchantCode).ToList(); if (tempAutoFactoryCustomerList.Count == 1) { tempAutoFactoryCode = tempAutoFactoryCustomerList[0].AFC_Code; } #region 获取商户数据库配置Key _arMerchantCode = BLLCom.GetMerchantDbConfigKey(tempAutoFactoryCode); if (string.IsNullOrEmpty(_arMerchantCode)) { //请选择有效的汽修商户 MessageBoxs.Show(Trans.IS, this.ToString(), MsgHelp.GetMsg(MsgCode.E_0013, MsgParam.VALID + MsgParam.OF + MsgParam.AUTOFACTORY), MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } #endregion return(true); }
/// <summary> /// 初始化 /// </summary> private void InitializeListTabControls() { lblWhere_InvAROrgName.Visible = true; mcbWhere_InvAROrgName.Visible = true; mcbWhere_InvARMerchant.Clear(); mcbWhere_InvAROrgName.Clear(); rbVehicleBrand.Checked = true; rbVehicleInspire.Checked = false; GridDS = new BindingList <AFOrgVehicleBrandInspireQueryUIModel>(); gdInventory.DataSource = GridDS; gdInventory.DataBind(); #region 初始化下拉框 //汽修商户名称 _autoFactoryList = CacheDAX.Get(CacheDAX.ConfigDataKey.ARMerchant) as List <MDLPIS_AutoFactoryCustomer>; if (_autoFactoryList != null) { var autoFactoryCustomerList = _autoFactoryList.Where(x => x.AFC_IsPlatform != null && x.AFC_IsPlatform.Value == true).ToList(); mcbWhere_InvARMerchant.DisplayMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Name; mcbWhere_InvARMerchant.ValueMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Code; mcbWhere_InvARMerchant.DataSource = autoFactoryCustomerList; } //汽修商户组织 var allCustomerList = CacheDAX.Get(CacheDAX.ConfigDataKey.Customer) as List <CustomerQueryUIModel>; if (allCustomerList != null) { _autoFactoryOrgList = allCustomerList.Where(x => x.CustomerType == CustomerTypeEnum.Name.PTNQXSH).ToList(); } mcbWhere_InvAROrgName.DisplayMember = "CustomerName"; mcbWhere_InvAROrgName.ValueMember = "AutoFactoryOrgInfo"; if (!string.IsNullOrEmpty(mcbWhere_InvARMerchant.SelectedValue)) { var tempAutoFactoryOrgList = _autoFactoryOrgList.Where(x => x.AutoFactoryCode == mcbWhere_InvARMerchant.SelectedValue); mcbWhere_InvAROrgName.DataSource = tempAutoFactoryOrgList; } #endregion }
/// <summary> /// 初始化【详情】Tab内控件 /// </summary> private void InitializeDetailTabControls() { #region 初始化【详情】Tab内控件 //配件类别名称 txtAPT_Name.Clear(); //父类名称 mcbAPT_ParentName.Clear(); //顺序 txtAPT_Index.Clear(); //有效 ckAPT_IsValid.Checked = true; ckAPT_IsValid.CheckState = CheckState.Checked; //创建人 txtAPT_CreatedBy.Text = LoginInfoDAX.UserName; //创建时间 dtAPT_CreatedTime.Value = BLLCom.GetCurStdDatetime(); //修改人 txtAPT_UpdatedBy.Text = LoginInfoDAX.UserName; //修改时间 dtAPT_UpdatedTime.Value = BLLCom.GetCurStdDatetime(); //版本号 txtAPT_VersionNo.Clear(); //配件类别ID txtAPT_ID.Clear(); //给 配件类别名称 设置焦点 lblAPT_Name.Focus(); #endregion #region 初始化下拉框 //配件类别 _autoPartsTypeList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsType) as List <MDLBS_AutoPartsType>; //父级 mcbAPT_ParentName.DisplayMember = SystemTableColumnEnums.BS_AutoPartsType.Code.APT_Name; mcbAPT_ParentName.ValueMember = SystemTableColumnEnums.BS_AutoPartsType.Code.APT_ID; mcbAPT_ParentName.DataSource = _autoPartsTypeList; #endregion }
/// <summary> /// 初始化【列表】Tab内控件 /// </summary> private void InitializeListTabControls() { #region 查询条件初始化 //配件名称 mcbWhere_APA_Name.Clear(); if (mcbWhere_Supplier.Enabled) { //供应商 mcbWhere_Supplier.Clear(); } //配件条码(配件条形码+批次号) txtWhere_Barcode.Clear(); //配件编码(原厂编码或第三方编码) txtWhere_AutoPartsCode.Clear(); //其他描述(专有属性或适用范围中的任一项) txtWhere_OtherDesc.Clear(); //车型代码 txtWhere_APA_VehicleModelCode.Clear(); //仓库 mcbWhere_Warehouse.Clear(); //仓位 mcbWhere_WarehouseBin.Clear(); //入库时间 dtWhere_StockInTimeStart.Value = null; dtWhere_StockInTimeEnd.Value = null; //配件品牌 txtWhere_APA_Brand.Clear(); //车辆品牌 mcbWhere_APA_VehicleBrand.Clear(); //车系 mcbWhere_APA_VehicleInspire.Clear(); //给 配件名称 设置焦点 lblWhere_APA_Name.Focus(); #endregion #region 初始化下拉框 //配件名称 _autoPartsNameList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsName) as List <MDLBS_AutoPartsName>; mcbWhere_APA_Name.DisplayMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_Name; mcbWhere_APA_Name.ValueMember = SystemTableColumnEnums.BS_AutoPartsName.Code.APN_ID; mcbWhere_APA_Name.DataSource = _autoPartsNameList; //供应商 _supplierList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsSupplier) as List <MDLPIS_Supplier>; mcbWhere_Supplier.DisplayMember = SystemTableColumnEnums.PIS_Supplier.Code.SUPP_Name; mcbWhere_Supplier.ValueMember = SystemTableColumnEnums.PIS_Supplier.Code.SUPP_ID; if (mcbWhere_Supplier.Enabled) { mcbWhere_Supplier.DataSource = _supplierList; } //车辆品牌 _vehicleBrandList = CacheDAX.Get(CacheDAX.ConfigDataKey.VehicleBrand) as List <MDLBS_VehicleBrandInspireSumma>; mcbWhere_APA_VehicleBrand.DisplayMember = SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Brand; mcbWhere_APA_VehicleBrand.ValueMember = SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Brand; mcbWhere_APA_VehicleBrand.DataSource = _vehicleBrandList; //车辆车系 _vehicleInspireList = CacheDAX.Get(CacheDAX.ConfigDataKey.VehicleBrandInspire) as List <MDLBS_VehicleBrandInspireSumma>; mcbWhere_APA_VehicleInspire.DisplayMember = SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Inspire; mcbWhere_APA_VehicleInspire.ValueMember = SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Inspire; mcbWhere_APA_VehicleInspire.DataSource = _vehicleInspireList; //仓库 var allWarehouseList = CacheDAX.Get(CacheDAX.ConfigDataKey.Warehouse) as List <MDLPIS_Warehouse>; mcbWhere_Warehouse.DisplayMember = SystemTableColumnEnums.PIS_Warehouse.Code.WH_Name; mcbWhere_Warehouse.ValueMember = SystemTableColumnEnums.PIS_Warehouse.Code.WH_ID; if (allWarehouseList != null) { _warehouseList = allWarehouseList.Where(x => x.WH_Org_ID == LoginInfoDAX.OrgID).ToList(); mcbWhere_Warehouse.DataSource = _warehouseList; } //仓位 _warehouseBinList = CacheDAX.Get(CacheDAX.ConfigDataKey.WarehouseBin) as List <MDLPIS_WarehouseBin>; mcbWhere_WarehouseBin.DisplayMember = SystemTableColumnEnums.PIS_WarehouseBin.Code.WHB_Name; mcbWhere_WarehouseBin.ValueMember = SystemTableColumnEnums.PIS_WarehouseBin.Code.WHB_ID; if (_warehouseBinList != null && !string.IsNullOrEmpty(mcbWhere_Warehouse.SelectedValue)) { var curWarehouseBinList = _warehouseBinList.Where(x => x.WHB_WH_ID == mcbWhere_Warehouse.SelectedValue).ToList(); mcbWhere_WarehouseBin.DataSource = curWarehouseBinList; } #endregion //清空Grid ListGridDS = new List <PickPartsQueryUIModel>(); gdGrid.DataSource = ListGridDS; gdGrid.DataBind(); }
/// <summary> /// 删除仓库 /// </summary> /// <param name="paramWarehouseList">待删除的仓库列表</param> /// <param name="paramWarehouseBinList">待删除的仓位列表</param> /// <returns></returns> public bool DeleteWarehouseAndBin(List <MDLPIS_Warehouse> paramWarehouseList, List <MDLPIS_WarehouseBin> paramWarehouseBinList) { if (paramWarehouseList == null || paramWarehouseList.Count == 0) { //请选择要删除的仓库 ResultMsg = MsgHelp.GetMsg(MsgCode.W_0006, new object[] { SystemActionEnum.Name.DELETE + SystemTableEnums.Name.PIS_Warehouse }); return(false); } try { DBManager.BeginTransaction(DBCONFIG.Coeus); #region 除仓位 var deleteWarehouseBinResult = _bll.DeleteByList <MDLPIS_WarehouseBin, MDLPIS_WarehouseBin>(paramWarehouseBinList); if (!deleteWarehouseBinResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); //删除[仓位]信息失败 ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.DELETE + SystemTableEnums.Name.PIS_WarehouseBin }); return(false); } #endregion #region 除仓库 var deleteWarehouseResult = _bll.DeleteByList <MDLPIS_Warehouse, MDLPIS_Warehouse>(paramWarehouseList); if (!deleteWarehouseResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); //删除[仓库]信息失败 ResultMsg = MsgHelp.GetMsg(MsgCode.E_0000, new object[] { SystemActionEnum.Name.DELETE + SystemTableEnums.Name.PIS_Warehouse }); return(false); } #endregion DBManager.CommitTransaction(DBCONFIG.Coeus); } catch (Exception ex) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.DELETE, ex.Message }); LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, MethodBase.GetCurrentMethod().ToString(), ex.Message, "", null); return(false); } #region 刷新缓存 //刷新仓库缓存 var resultWarehouseList = CacheDAX.Get(CacheDAX.ConfigDataKey.Warehouse) as List <MDLPIS_Warehouse>; if (resultWarehouseList != null) { var newWarehouseList = resultWarehouseList; //待移除的仓库 List <MDLPIS_Warehouse> removeWarehouseList = new List <MDLPIS_Warehouse>(); foreach (var loopWarehouse in newWarehouseList) { var deleteWarehouse = paramWarehouseList.FirstOrDefault(x => x.WH_ID == loopWarehouse.WH_ID); if (deleteWarehouse != null) { removeWarehouseList.Add(loopWarehouse); } } foreach (var loopWarehouse in removeWarehouseList) { newWarehouseList.Remove(loopWarehouse); } CacheDAX.Remove(CacheDAX.ConfigDataKey.Warehouse); CacheDAX.Add(CacheDAX.ConfigDataKey.Warehouse, newWarehouseList, true); } //刷新仓位缓存 var resultWarehouseBinList = CacheDAX.Get(CacheDAX.ConfigDataKey.WarehouseBin) as List <MDLPIS_WarehouseBin>; if (resultWarehouseBinList != null) { var newWarehouseBinList = resultWarehouseBinList; //待移除的仓位 List <MDLPIS_WarehouseBin> removeWarehouseBinList = new List <MDLPIS_WarehouseBin>(); foreach (var loopWarehouseBin in newWarehouseBinList) { var deleteWarehouseBin = paramWarehouseBinList.FirstOrDefault(x => x.WHB_ID == loopWarehouseBin.WHB_ID); if (deleteWarehouseBin != null) { removeWarehouseBinList.Add(loopWarehouseBin); } } foreach (var loopWarehouseBin in removeWarehouseBinList) { newWarehouseBinList.Remove(loopWarehouseBin); } CacheDAX.Remove(CacheDAX.ConfigDataKey.WarehouseBin); CacheDAX.Add(CacheDAX.ConfigDataKey.WarehouseBin, newWarehouseBinList, true); } #endregion return(true); }
/// <summary> /// 初始化【详情】Tab内控件 /// </summary> private void InitializeDetailTabControls() { #region 工具生成 //钱包账号 txtWal_No.Clear(); //来源类型 cbWal_SourceTypeName.Items.Clear(); //来源账号 txtWal_SourceNo.Clear(); //所有人类别 cbWal_OwnerTypeName.Items.Clear(); //开户人 txtWal_CustomerName.Clear(); //汽修商户 mcbAutoFactoryName.Clear(); //可用余额 txtWal_AvailableBalance.Clear(); //冻结余额 txtWal_FreezingBalance.Clear(); //推荐员工 mcbWal_RecommendEmployee.Clear(); //生效时间 dtWal_EffectiveTime.Value = null; //失效时间 dtWal_IneffectiveTime.Value = null; //开户组织 txtWal_CreatedByOrgName.Clear(); //状态 cbWal_StatusName.Items.Clear(); //备注 txtWal_Remark.Clear(); //有效 ckWal_IsValid.Checked = true; ckWal_IsValid.CheckState = CheckState.Checked; //创建人 txtWal_CreatedBy.Text = LoginInfoDAX.UserName; //创建时间 dtWal_CreatedTime.Value = DateTime.Now; //修改人 txtWal_UpdatedBy.Text = LoginInfoDAX.UserName; //修改时间 dtWal_UpdatedTime.Value = DateTime.Now; //钱包ID txtWal_ID.Clear(); //组织ID txtWal_Org_ID.Clear(); //组织名称 txtWal_Org_Name.Clear(); //开户人ID txtWal_CustomerID.Clear(); //汽修商户组织编码 txtWal_AutoFactoryOrgCode.Clear(); //交易密码 txtWal_TradingPassword.Clear(); //充值基数 txtWal_DepositBaseAmount.Clear(); //开户组织ID txtWal_CreatedByOrgID.Clear(); //版本号 txtWal_VersionNo.Clear(); //给 钱包账号 设置焦点 lblWal_No.Focus(); #endregion #region 初始化下拉框 //所有人类别 _ownerTypeList = EnumDAX.GetEnumForComboBoxWithCodeText(EnumKey.CustomerType); cbWal_OwnerTypeName.DisplayMember = SysConst.EN_TEXT; cbWal_OwnerTypeName.ValueMember = SysConst.EN_Code; cbWal_OwnerTypeName.DataSource = _ownerTypeList; cbWal_OwnerTypeName.DataBind(); //钱包状态 _walletStatusList = EnumDAX.GetEnumForComboBoxWithCodeText(EnumKey.WalletStatus); cbWal_StatusName.DisplayMember = SysConst.EN_TEXT; cbWal_StatusName.ValueMember = SysConst.EN_Code; cbWal_StatusName.DataSource = _walletStatusList; cbWal_StatusName.DataBind(); //来源类型 _walletSourceTypeList = EnumDAX.GetEnumForComboBoxWithCodeText(EnumKey.WalletSourceType); cbWal_SourceTypeName.DisplayMember = SysConst.EN_TEXT; cbWal_SourceTypeName.ValueMember = SysConst.EN_Code; cbWal_SourceTypeName.DataSource = _walletSourceTypeList; cbWal_SourceTypeName.DataBind(); //汽修商户名称 _autoFactoryList = CacheDAX.Get(CacheDAX.ConfigDataKey.ARMerchant) as List <MDLPIS_AutoFactoryCustomer>; if (_autoFactoryList != null) { var autoFactoryCustomerList = _autoFactoryList.Where(x => x.AFC_IsPlatform == true).ToList(); mcbAutoFactoryName.DisplayMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Name; mcbAutoFactoryName.ValueMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Code; mcbAutoFactoryName.DataSource = autoFactoryCustomerList; } //推荐员工 _autoUserList = CacheDAX.Get(CacheDAX.ConfigDataKey.SystemUser) as List <MDLSM_User>; mcbWal_RecommendEmployee.DisplayMember = SystemTableColumnEnums.SM_User.Code.User_Name; mcbWal_RecommendEmployee.ValueMember = SystemTableColumnEnums.SM_User.Code.User_ID; mcbWal_RecommendEmployee.DataSource = _autoUserList; #endregion }
/// <summary> /// 初始化【列表】Tab内控件 /// </summary> private void InitializeListTabControls() { #region 工具生成 #region 查询条件初始化 //钱包账号 txtWhere_WalT_Wal_No.Clear(); //受理组织 cbWhere_WalT_Org_ID.Items.Clear(); //所有人类别 cbWhere_Wal_OwnerTypeName.Items.Clear(); //汽修商户 mcbWhere_AutoFactoryName.Clear(); //开户人 txtWhere_Wal_CustomerName.Clear(); //异动类型 cbWhere_WalT_TypeName.Items.Clear(); //充值方式 cbWhere_WalT_RechargeTypeName.Items.Clear(); //异动单号 txtWhere_WalT_BillNo.Clear(); //异动时间-开始 dtWhere_WalT_TimeStart.Value = null; //异动时间-终了 dtWhere_WalT_TimeEnd.Value = null; //开户人手机号 txtWhere_CustomerPhoneNo.Clear(); //备注 txtWhere_WalT_Remark.Clear(); //给 钱包账号 设置焦点 lblWhere_WalT_Wal_No.Focus(); #endregion #region Grid初始化 //清空Grid GridDS = new BindingList <WalletTransLogQueryUIModel>(); gdGrid.DataSource = GridDS; gdGrid.DataBind(); #endregion #endregion #region 初始化下拉框 //组织 _orgList = LoginInfoDAX.OrgList; cbWhere_WalT_Org_ID.DisplayMember = SystemTableColumnEnums.SM_Organization.Code.Org_ShortName; cbWhere_WalT_Org_ID.ValueMember = SystemTableColumnEnums.SM_Organization.Code.Org_ID; cbWhere_WalT_Org_ID.DataSource = _orgList; cbWhere_WalT_Org_ID.DataBind(); //所有人类别 _ownerTypeList = EnumDAX.GetEnumForComboBoxWithCodeText(EnumKey.CustomerType); cbWhere_Wal_OwnerTypeName.DisplayMember = SysConst.EN_TEXT; cbWhere_Wal_OwnerTypeName.ValueMember = SysConst.EN_Code; cbWhere_Wal_OwnerTypeName.DataSource = _ownerTypeList; cbWhere_Wal_OwnerTypeName.DataBind(); //异动类型 _walletTransTypeList = EnumDAX.GetEnumForComboBoxWithCodeText(EnumKey.WalTransType); cbWhere_WalT_TypeName.DisplayMember = SysConst.EN_TEXT; cbWhere_WalT_TypeName.ValueMember = SysConst.EN_Code; cbWhere_WalT_TypeName.DataSource = _walletTransTypeList; cbWhere_WalT_TypeName.DataBind(); //汽修商户名称 _autoFactoryList = CacheDAX.Get(CacheDAX.ConfigDataKey.ARMerchant) as List <MDLPIS_AutoFactoryCustomer>; if (_autoFactoryList != null) { var autoFactoryCustomerList = _autoFactoryList.Where(x => x.AFC_IsPlatform == true).ToList(); mcbWhere_AutoFactoryName.DisplayMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Name; mcbWhere_AutoFactoryName.ValueMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Code; mcbWhere_AutoFactoryName.DataSource = autoFactoryCustomerList; } //充值方式 _rechargeTypeList = EnumDAX.GetEnumForComboBoxWithCodeText(EnumKey.TradeType); var tempRechargeTypeList = _rechargeTypeList.Where(x => x.Text != TradeTypeEnum.Name.WALLET && x.Text != TradeTypeEnum.Name.ONACCOUNT).ToList(); cbWhere_WalT_RechargeTypeName.DisplayMember = SysConst.EN_TEXT; cbWhere_WalT_RechargeTypeName.ValueMember = SysConst.EN_Code; cbWhere_WalT_RechargeTypeName.DataSource = tempRechargeTypeList; cbWhere_WalT_RechargeTypeName.DataBind(); #endregion }
/// <summary> /// 删除数据 /// </summary> /// <param name="paramVehicleBrandInspireSummaList">待删除的车辆品牌车系列表</param> /// <returns></returns> public bool DeleteVehicleBrandInspire(List <MDLBS_VehicleBrandInspireSumma> paramVehicleBrandInspireSummaList) { try { DBManager.BeginTransaction(DBCONFIG.Coeus); var deleteVehicleBrandInspireResult = DeleteByList <MDLBS_VehicleBrandInspireSumma, MDLBS_VehicleBrandInspireSumma>(paramVehicleBrandInspireSummaList); if (!deleteVehicleBrandInspireResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.DELETE, SystemTableEnums.Name.BS_VehicleBrandInspireSumma }); return(false); } DBManager.CommitTransaction(DBCONFIG.Coeus); } catch (Exception ex) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.DELETE, ex.Message }); LogHelper.WriteErrorLog(BussID, MethodBase.GetCurrentMethod().ToString(), ex.Message + SysConst.ENTER + ex.StackTrace, null, ex); LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, MethodBase.GetCurrentMethod().ToString(), ex.Message, "", null); return(false); } //刷新车辆品牌缓存 var resultVehicleBrandList = CacheDAX.Get(CacheDAX.ConfigDataKey.VehicleBrand) as List <MDLBS_VehicleBrandInspireSumma>; if (resultVehicleBrandList != null) { var newVehicleBrandList = resultVehicleBrandList; //待移除的车辆品牌 List <MDLBS_VehicleBrandInspireSumma> removeVehicleBrandList = new List <MDLBS_VehicleBrandInspireSumma>(); foreach (var loopVehicleBrand in newVehicleBrandList) { var deleteVehicleBrand = paramVehicleBrandInspireSummaList.FirstOrDefault(x => x.VBIS_Brand == loopVehicleBrand.VBIS_Brand); if (deleteVehicleBrand != null) { removeVehicleBrandList.Add(loopVehicleBrand); } } foreach (var loopVehicleBrand in removeVehicleBrandList) { newVehicleBrandList.Remove(loopVehicleBrand); } CacheDAX.Remove(CacheDAX.ConfigDataKey.VehicleBrand); CacheDAX.Add(CacheDAX.ConfigDataKey.VehicleBrand, newVehicleBrandList, true); } //刷新车辆车系缓存 var resultVehicleInspireList = CacheDAX.Get(CacheDAX.ConfigDataKey.VehicleBrandInspire) as List <MDLBS_VehicleBrandInspireSumma>; if (resultVehicleInspireList != null) { var newVehicleInspireList = resultVehicleInspireList; //待移除的车辆品牌 List <MDLBS_VehicleBrandInspireSumma> removeVehicleInspireList = new List <MDLBS_VehicleBrandInspireSumma>(); foreach (var loopVehicleInspire in newVehicleInspireList) { var deleteVehicleInspire = paramVehicleBrandInspireSummaList.FirstOrDefault(x => x.VBIS_Inspire == loopVehicleInspire.VBIS_Inspire); if (deleteVehicleInspire != null) { removeVehicleInspireList.Add(loopVehicleInspire); } } foreach (var loopVehicleInspire in removeVehicleInspireList) { newVehicleInspireList.Remove(loopVehicleInspire); } CacheDAX.Remove(CacheDAX.ConfigDataKey.VehicleBrandInspire); CacheDAX.Add(CacheDAX.ConfigDataKey.VehicleBrandInspire, newVehicleInspireList, true); } return(true); }
/// <summary> /// 初始化【详情】Tab内控件 /// </summary> private void InitializeDetailTabControls() { #region 工具生成 //钱包ID txtWal_ID.Clear(); //钱包账号 txtWal_No.Clear(); //开户人ID txtWal_CustomerID.Clear(); //开户人姓名 txtWal_CustomerName.Clear(); //汽修商户 mcbAutoFactoryName.Clear(); //汽修商户组织编码 txtWal_AutoFactoryOrgCode.Clear(); //本次充值金额 txtThisDepositAmount.Clear(); //可用余额 txtWal_AvailableBalance.Clear(); _oldAvailableBalance = 0; //充值基数 txtWal_DepositBaseAmount.Clear(); //备注 txtWal_Remark.Clear(); //版本号 txtWal_VersionNo.Clear(); #endregion //清除最后账号 _latestWalletNo = string.Empty; #region 初始化下拉框 //汽修商户名称 _autoFactoryList = CacheDAX.Get(CacheDAX.ConfigDataKey.ARMerchant) as List <MDLPIS_AutoFactoryCustomer>; if (_autoFactoryList != null) { var autoFactoryCustomerList = _autoFactoryList.Where(x => x.AFC_IsPlatform == true).ToList(); mcbAutoFactoryName.DisplayMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Name; mcbAutoFactoryName.ValueMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Code; mcbAutoFactoryName.DataSource = autoFactoryCustomerList; } #endregion #region 加载充值明细列表 _depositDetailList = new List <WalletDepositMoneyUIModel>(); List <MDLSM_Enum> tempPaymentModeList = EnumDAX.GetEnum(EnumKey.TradeType); foreach (var loopPaymentMode in tempPaymentModeList) { if (loopPaymentMode.Enum_DisplayName != TradeTypeEnum.Name.WALLET && loopPaymentMode.Enum_DisplayName != TradeTypeEnum.Name.ONACCOUNT) { //支付方式:{现金}、{网银转账}、{POS}、{微信}、{支付宝}、{支票}、{其他}、 WalletDepositMoneyUIModel tempDepositMoney = new WalletDepositMoneyUIModel() { PaymentModeName = loopPaymentMode.Enum_DisplayName, PaymentModeCode = loopPaymentMode.Enum_ValueCode, }; _depositDetailList.Add(tempDepositMoney); } } gdGrid.DataSource = _depositDetailList; gdGrid.DataBind(); #endregion }
/// <summary> /// 保存数据 /// </summary> /// <param name="paramModel">待保存的车辆品牌车系</param> /// <returns></returns> public bool SaveDetailDS(VehicleBrandInspireSummaManagerUIModel paramModel) { //服务端检查 if (!ServerCheck(paramModel)) { return(false); } //将UIModel转为TBModel var argsVehicleBrandInspireSumma = CopyModel <MDLBS_VehicleBrandInspireSumma>(paramModel); try { DBManager.BeginTransaction(DBCONFIG.Coeus); //判断主键是否被赋值 if (string.IsNullOrEmpty(argsVehicleBrandInspireSumma.VBIS_ID)) { #region 新增 if (argsVehicleBrandInspireSumma.VBIS_IsValid == true) { #region 步平台数据 //获取车辆品牌车系信息 string argsPostData = string.Format(ApiParameter.BF0020, argsVehicleBrandInspireSumma.VBIS_Brand, argsVehicleBrandInspireSumma.VBIS_Inspire, ConfigurationManager.AppSettings[AppSettingKey.MCT_CODE]); string strApiData = APIDataHelper.GetAPIData(ApiUrl.BF0020Url, argsPostData); var jsonResult = (JObject)JsonConvert.DeserializeObject(strApiData); if (jsonResult != null && jsonResult[SysConst.EN_RESULTCODE] != null && jsonResult[SysConst.EN_RESULTCODE].ToString().Equals(SysConst.EN_I0001)) { paramModel.VBIS_Brand = jsonResult[SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Brand] == null ? "" : jsonResult[SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Brand].ToString(); paramModel.VBIS_Inspire = jsonResult[SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Inspire] == null ? "" : jsonResult[SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Inspire].ToString(); paramModel.VBIS_Model = jsonResult[SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Model] == null ? "" : jsonResult[SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_Model].ToString(); paramModel.VBIS_BrandSpellCode = jsonResult[SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_BrandSpellCode] == null ? "" : jsonResult[SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_BrandSpellCode].ToString(); paramModel.VBIS_InspireSpellCode = jsonResult[SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_InspireSpellCode] == null ? "" : jsonResult[SystemTableColumnEnums.BS_VehicleBrandInspireSumma.Code.VBIS_InspireSpellCode].ToString(); paramModel.VBIS_IsValid = true; paramModel.VBIS_CreatedBy = LoginInfoDAX.UserName; paramModel.VBIS_UpdatedBy = LoginInfoDAX.UserName; } else { var strErrorMessage = jsonResult == null ? "" : jsonResult["ResultMsg"].ToString(); LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, MethodBase.GetCurrentMethod().ToString(), strErrorMessage, "", null); } #endregion } //生成新ID argsVehicleBrandInspireSumma.VBIS_ID = Guid.NewGuid().ToString(); argsVehicleBrandInspireSumma.VBIS_CreatedBy = LoginInfoDAX.UserName; argsVehicleBrandInspireSumma.VBIS_CreatedTime = BLLCom.GetCurStdDatetime(); argsVehicleBrandInspireSumma.VBIS_UpdatedBy = LoginInfoDAX.UserName; argsVehicleBrandInspireSumma.VBIS_UpdatedTime = BLLCom.GetCurStdDatetime(); //主键未被赋值,则执行新增 if (!_bll.Insert(argsVehicleBrandInspireSumma)) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.NEW + SystemTableEnums.Name.BS_VehicleBrandInspireSumma }); return(false); } #endregion } else { #region 更新 //主键被赋值,则需要更新,更新需要设定更新条件 argsVehicleBrandInspireSumma.WHERE_VBIS_ID = argsVehicleBrandInspireSumma.VBIS_ID; argsVehicleBrandInspireSumma.WHERE_VBIS_VersionNo = argsVehicleBrandInspireSumma.VBIS_VersionNo; argsVehicleBrandInspireSumma.VBIS_VersionNo++; argsVehicleBrandInspireSumma.VBIS_UpdatedBy = LoginInfoDAX.UserName; argsVehicleBrandInspireSumma.VBIS_UpdatedTime = BLLCom.GetCurStdDatetime(); if (!_bll.Update(argsVehicleBrandInspireSumma)) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { MsgParam.UPDATE + SystemTableEnums.Name.BS_VehicleBrandInspireSumma }); return(false); } #endregion } DBManager.CommitTransaction(DBCONFIG.Coeus); } catch (Exception ex) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.SAVE, ex.Message }); LogHelper.WriteErrorLog(BussID, MethodBase.GetCurrentMethod().ToString(), ex.Message + SysConst.ENTER + ex.StackTrace, null, ex); LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, MethodBase.GetCurrentMethod().ToString(), ex.Message, "", null); return(false); } //将最新数据回写给DetailDS CopyModel(argsVehicleBrandInspireSumma, paramModel); //刷新车辆品牌缓存 var resultVehicleBrandList = CacheDAX.Get(CacheDAX.ConfigDataKey.VehicleBrand) as List <MDLBS_VehicleBrandInspireSumma>; List <MDLBS_VehicleBrandInspireSumma> newVehicleBrandList = new List <MDLBS_VehicleBrandInspireSumma>(); if (resultVehicleBrandList != null) { newVehicleBrandList = resultVehicleBrandList; if (resultVehicleBrandList.All(x => x.VBIS_Brand != argsVehicleBrandInspireSumma.VBIS_Brand)) { newVehicleBrandList.Insert(0, argsVehicleBrandInspireSumma); newVehicleBrandList = newVehicleBrandList.GroupBy(p => new { p.VBIS_Brand, p.VBIS_BrandSpellCode }) .Select(g => g.First()).OrderBy(x => x.VBIS_Brand).ToList(); CacheDAX.Add(CacheDAX.ConfigDataKey.VehicleBrand, newVehicleBrandList, true); } } else { newVehicleBrandList.Add(argsVehicleBrandInspireSumma); CacheDAX.Add(CacheDAX.ConfigDataKey.VehicleBrand, newVehicleBrandList, true); } //刷新车辆车系缓存 var resultVehicleInspireList = CacheDAX.Get(CacheDAX.ConfigDataKey.VehicleBrandInspire) as List <MDLBS_VehicleBrandInspireSumma>; List <MDLBS_VehicleBrandInspireSumma> newVehicleInspireList = new List <MDLBS_VehicleBrandInspireSumma>(); if (resultVehicleInspireList != null) { newVehicleInspireList = resultVehicleInspireList; if (resultVehicleInspireList.All(x => x.VBIS_Brand != argsVehicleBrandInspireSumma.VBIS_Brand)) { newVehicleInspireList.Insert(0, argsVehicleBrandInspireSumma); newVehicleInspireList = newVehicleInspireList.GroupBy(p => new { p.VBIS_Brand, p.VBIS_Inspire, p.VBIS_InspireSpellCode }) .Select(g => g.First()).OrderBy(x => x.VBIS_Brand).ThenBy(x => x.VBIS_Inspire).ToList(); CacheDAX.Add(CacheDAX.ConfigDataKey.VehicleBrandInspire, newVehicleInspireList, true); } } else { newVehicleInspireList.Add(argsVehicleBrandInspireSumma); CacheDAX.Add(CacheDAX.ConfigDataKey.VehicleBrandInspire, newVehicleInspireList, true); } return(true); }
/// <summary> /// 初始化【列表】Tab内控件 /// </summary> private void InitializeListTabControls() { #region 工具生成 #region 查询条件初始化 //单据编号 txtWhere_SFO_No.Clear(); //汽修商户组织名称 mcbWhere_SFO_AutoFactoryName.Clear(); //客户名称 mcbWhere_SFO_CustomerName.Clear(); //来源类型 cbWhere_SFO_SourceTypeName.Clear(); //单据状态 cbWhere_SFO_StatusName.Clear(); //创建时间-开始 dtWhere_CreatedTimeStart.Value = null; //创建时间-终了 dtWhere_CreatedTimeEnd.Value = null; //给 单据编号 设置焦点 lblWhere_SFO_No.Focus(); #endregion #region Grid初始化 //清空Grid HeadGridDS = new BindingList <SalesForecastOrderManageUIModel>(); gdGrid.DataSource = HeadGridDS; gdGrid.DataBind(); #endregion #endregion #region 初始化下拉框 //汽修商户 _autoFactoryList = CacheDAX.Get(CacheDAX.ConfigDataKey.ARMerchant) as List <MDLPIS_AutoFactoryCustomer>; if (_autoFactoryList != null) { var tempAutoFactoryList = _autoFactoryList.Where(x => x.AFC_IsPlatform != null && x.AFC_IsPlatform.Value == true).ToList(); mcbWhere_SFO_AutoFactoryName.DisplayMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Name; mcbWhere_SFO_AutoFactoryName.ValueMember = SystemTableColumnEnums.PIS_AutoFactoryCustomer.Code.AFC_Code; mcbWhere_SFO_AutoFactoryName.DataSource = tempAutoFactoryList; } //汽修商户组织 var allCustomerList = CacheDAX.Get(CacheDAX.ConfigDataKey.Customer) as List <CustomerQueryUIModel>; if (allCustomerList != null) { _autoFactoryOrgList = allCustomerList.Where(x => x.CustomerType == CustomerTypeEnum.Name.PTNQXSH).ToList(); mcbWhere_SFO_CustomerName.DisplayMember = "CustomerName"; mcbWhere_SFO_CustomerName.ValueMember = "AutoFactoryOrgInfo"; mcbWhere_SFO_CustomerName.DataSource = _autoFactoryOrgList; } //来源类型 List <ComComboBoxDataSourceTC> resultSalesForecastOrderSourceTypeList = EnumDAX.GetEnumForComboBoxWithCodeText(EnumKey.SalesForecastOrderSourceType); cbWhere_SFO_SourceTypeName.DisplayMember = SysConst.EN_TEXT; cbWhere_SFO_SourceTypeName.ValueMember = SysConst.EN_Code; cbWhere_SFO_SourceTypeName.DataSource = resultSalesForecastOrderSourceTypeList; cbWhere_SFO_SourceTypeName.DataBind(); //单据状态 List <ComComboBoxDataSourceTC> resultStatusList = EnumDAX.GetEnumForComboBoxWithCodeText(EnumKey.SalesForecastOrderStatus); cbWhere_SFO_StatusName.DisplayMember = SysConst.EN_TEXT; cbWhere_SFO_StatusName.ValueMember = SysConst.EN_Code; cbWhere_SFO_StatusName.DataSource = resultStatusList; cbWhere_SFO_StatusName.DataBind(); #endregion }
/// <summary> /// 保存 /// </summary> /// <param name="paramUser"></param> /// <param name="paramUserOrgList"></param> /// <returns></returns> public bool SaveDetailDS(UserManagerUIModel paramUser, SkyCarBindingList <UserOrgUIModel, MDLSM_UserOrg> paramUserOrgList) { #region 带事务的保存 //将UIModel转为TBModel var argsUser = paramUser.ToTBModelForSaveAndDelete <MDLSM_User>(); try { DBManager.BeginTransaction(DBCONFIG.Coeus); #region 保存用户信息 if (string.IsNullOrEmpty(paramUser.User_ID)) { argsUser.User_ID = Guid.NewGuid().ToString(); argsUser.User_CreatedBy = LoginInfoDAX.UserName; argsUser.User_CreatedTime = BLLCom.GetCurStdDatetime(); } argsUser.User_IsValid = true; argsUser.User_UpdatedBy = LoginInfoDAX.UserName; argsUser.User_UpdatedTime = BLLCom.GetCurStdDatetime(); bool saveUserResult = _bll.Save(argsUser); if (!saveUserResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.SAVE + SystemTableEnums.Name.SM_User }); return(false); } #endregion //保存用户组织信息 if (paramUserOrgList != null && paramUserOrgList.InsertList != null && paramUserOrgList.InsertList.Count > 0) { foreach (var loopUserOrg in paramUserOrgList.InsertList) { loopUserOrg.UO_User_ID = argsUser.User_ID ?? argsUser.WHERE_User_ID; loopUserOrg.UO_CreatedBy = LoginInfoDAX.UserName; loopUserOrg.UO_CreatedTime = BLLCom.GetCurStdDatetime(); loopUserOrg.UO_UpdatedBy = LoginInfoDAX.UserName; loopUserOrg.UO_UpdatedTime = BLLCom.GetCurStdDatetime(); } bool saveUserOrgResult = _bll.InsertByList <UserOrgUIModel, MDLSM_UserOrg>(paramUserOrgList.InsertList); if (!saveUserOrgResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.SAVE + SystemTableEnums.Name.SM_UserOrg }); return(false); } } if (paramUserOrgList != null && paramUserOrgList.DeleteList != null && paramUserOrgList.DeleteList.Count > 0) { foreach (var loopUserOrg in paramUserOrgList.DeleteList) { loopUserOrg.WHERE_UO_ID = loopUserOrg.UO_ID; } bool deleteUserOrgResult = _bll.DeleteByList <UserOrgUIModel, MDLSM_UserOrg>(paramUserOrgList.DeleteList); if (!deleteUserOrgResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.SAVE + SystemTableEnums.Name.SM_UserOrg }); return(false); } } DBManager.CommitTransaction(DBCONFIG.Coeus); } catch (Exception ex) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.SAVE, ex.Message }); LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, MethodBase.GetCurrentMethod().ToString(), ex.Message, "", null); return(false); } //将最新数据回写给DetailDS _bll.CopyModel(argsUser, paramUser); //刷新用户缓存 var resultUserList = CacheDAX.Get(CacheDAX.ConfigDataKey.SystemUser) as List <MDLSM_User>; List <MDLSM_User> newUserList = new List <MDLSM_User>(); if (resultUserList != null) { newUserList = resultUserList; if (resultUserList.All(x => x.User_ID != argsUser.User_ID && x.User_Name != argsUser.User_Name)) { newUserList.Insert(0, argsUser); CacheDAX.Add(CacheDAX.ConfigDataKey.SystemUser, newUserList, true); } } else { newUserList.Add(argsUser); CacheDAX.Add(CacheDAX.ConfigDataKey.SystemUser, newUserList, true); } return(true); #endregion }
/// <summary> /// 删除 /// </summary> /// <param name="paramUserList"></param> /// <returns></returns> public bool DeleteUserInfo(List <MDLSM_User> paramUserList) { //验证 if (paramUserList == null || paramUserList.Count == 0) { ResultMsg = MsgHelp.GetMsg(MsgCode.W_0016, new object[] { SystemTableEnums.Name.SM_User, SystemActionEnum.Name.DELETE }); return(false); } #region 准备数据 //待删除的[用户组织]列表 List <MDLSM_UserOrg> deleteUserOrgList = new List <MDLSM_UserOrg>(); //待删除的[用户菜单授权]列表 List <MDLSM_UserMenuAuthority> deleteUserMenuAuthoryList = new List <MDLSM_UserMenuAuthority>(); //待删除的[用户动作授权]列表 List <MDLSM_UserActionAuthority> deleteUserActionAuthoryList = new List <MDLSM_UserActionAuthority>(); string userIdString = SysConst.Semicolon_DBC; foreach (var loopUser in paramUserList) { if (string.IsNullOrEmpty(loopUser.User_ID)) { continue; } userIdString += loopUser.User_ID + SysConst.Semicolon_DBC; } //查询[用户组织]列表 _bll.QueryForList(SQLID.SM_UserManager_SQL06, userIdString, deleteUserOrgList); foreach (var loopDeleteUserOrg in deleteUserOrgList) { loopDeleteUserOrg.WHERE_UO_ID = loopDeleteUserOrg.UO_ID; } //查询[用户菜单授权]列表 _bll.QueryForList(SQLID.SM_UserManager_SQL07, userIdString, deleteUserMenuAuthoryList); foreach (var loopDeleteUserMenuAuthory in deleteUserMenuAuthoryList) { loopDeleteUserMenuAuthory.WHERE_UMA_ID = loopDeleteUserMenuAuthory.UMA_ID; } //查询[用户动作授权]列表 _bll.QueryForList(SQLID.SM_UserManager_SQL08, userIdString, deleteUserActionAuthoryList); foreach (var loopDeleteUserActionAuthory in deleteUserActionAuthoryList) { loopDeleteUserActionAuthory.WHERE_UAA_ID = loopDeleteUserActionAuthory.UAA_ID; } #endregion #region 带事务的更新和删除 try { DBManager.BeginTransaction(DBCONFIG.Coeus); //删除用户表 if (paramUserList.Count > 0) { bool deleteUserResult = _bll.DeleteByList <MDLSM_User, MDLSM_User>(paramUserList); if (!deleteUserResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.DELETE + SystemTableEnums.Name.SM_User }); return(false); } } //删除用户组织表【可能没有用户组织信息】 if (deleteUserOrgList.Count > 0) { bool deleteUserOrgResult = _bll.DeleteByList <MDLSM_UserOrg, MDLSM_UserOrg>(deleteUserOrgList); if (!deleteUserOrgResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.DELETE + SystemTableEnums.Name.SM_UserOrg }); return(false); } } //删除用户菜单表【可能没有用户菜单信息】 if (deleteUserMenuAuthoryList.Count > 0) { bool deleteUserMenuResult = _bll.DeleteByList <MDLSM_UserMenuAuthority, MDLSM_UserMenuAuthority>(deleteUserMenuAuthoryList); if (!deleteUserMenuResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.DELETE + SystemTableEnums.Name.SM_UserMenuAuthority }); return(false); } } //删除用户动作表【可能没有用户动作信息】 if (deleteUserActionAuthoryList.Count > 0) { bool deleteUserActionResult = _bll.DeleteByList <MDLSM_UserActionAuthority, MDLSM_UserActionAuthority>(deleteUserActionAuthoryList); if (!deleteUserActionResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.DELETE + SystemTableEnums.Name.SM_UserActionAuthority }); return(false); } } DBManager.CommitTransaction(DBCONFIG.Coeus); } catch (Exception ex) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.DELETE, ex.Message }); LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, MethodBase.GetCurrentMethod().ToString(), ex.Message, "", null); return(false); } #endregion //刷新用户缓存 var resultUserList = CacheDAX.Get(CacheDAX.ConfigDataKey.SystemUser) as List <MDLSM_User>; if (resultUserList != null) { var newUserList = resultUserList; //待移除的用户 List <MDLSM_User> removeUserList = new List <MDLSM_User>(); foreach (var loopUser in newUserList) { var deleteUser = paramUserList.FirstOrDefault(x => x.User_ID == loopUser.User_ID); if (deleteUser != null) { removeUserList.Add(loopUser); } } foreach (var loopUser in removeUserList) { newUserList.Remove(loopUser); } CacheDAX.Remove(CacheDAX.ConfigDataKey.SystemUser); CacheDAX.Add(CacheDAX.ConfigDataKey.SystemUser, newUserList, true); } return(true); }
/// <summary> /// 保存 /// </summary> /// <param name="paramModel">UIModel</param> /// <returns></returns> public bool SaveDetailDS(AutoPartsTypeManagerUIModel paramModel) { //服务端检查 if (!ServerCheck(paramModel)) { return(false); } #region 保存数据 //将UIModel转为TBModel var argsAutoPartsType = CopyModel <MDLBS_AutoPartsType>(paramModel); //判断主键是否被赋值 if (string.IsNullOrEmpty(argsAutoPartsType.APT_ID)) { #region 新增 //生成新ID argsAutoPartsType.APT_ID = Guid.NewGuid().ToString(); argsAutoPartsType.APT_CreatedBy = LoginInfoDAX.UserName; argsAutoPartsType.APT_CreatedTime = BLLCom.GetCurStdDatetime(); argsAutoPartsType.APT_UpdatedBy = LoginInfoDAX.UserName; argsAutoPartsType.APT_UpdatedTime = BLLCom.GetCurStdDatetime(); //主键未被赋值,则执行新增 if (!_bll.Insert(argsAutoPartsType)) { //新增[配件类别]信息失败 ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { MsgParam.ADD + SystemTableEnums.Name.BS_AutoPartsType }); return(false); } #endregion } else { #region 更新 //主键被赋值,则需要更新,更新需要设定更新条件 argsAutoPartsType.WHERE_APT_ID = argsAutoPartsType.APT_ID; argsAutoPartsType.WHERE_APT_VersionNo = argsAutoPartsType.APT_VersionNo; argsAutoPartsType.APT_VersionNo++; argsAutoPartsType.APT_UpdatedBy = LoginInfoDAX.UserName; argsAutoPartsType.APT_UpdatedTime = BLLCom.GetCurStdDatetime(); if (!_bll.Update(argsAutoPartsType)) { //更新[配件类别]信息失败! ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { MsgParam.UPDATE + SystemTableEnums.Name.BS_AutoPartsType }); return(false); } #endregion } //将最新数据回写给DetailDS CopyModel(argsAutoPartsType, paramModel); #endregion //刷新配件类别缓存 var resultAutoPartsTypeList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsType) as List <MDLBS_AutoPartsType>; List <MDLBS_AutoPartsType> newAutoPartsTypeList = new List <MDLBS_AutoPartsType>(); if (resultAutoPartsTypeList != null) { newAutoPartsTypeList = resultAutoPartsTypeList; if (resultAutoPartsTypeList.All(x => x.APT_ID != argsAutoPartsType.APT_ID && x.APT_Name != argsAutoPartsType.APT_Name)) { newAutoPartsTypeList.Add(argsAutoPartsType); CacheDAX.Add(CacheDAX.ConfigDataKey.AutoPartsType, newAutoPartsTypeList, true); } } else { newAutoPartsTypeList.Add(argsAutoPartsType); CacheDAX.Add(CacheDAX.ConfigDataKey.AutoPartsType, newAutoPartsTypeList, true); } return(true); }
/// <summary> /// 保存 /// </summary> /// <param name="paramModel">UIModel</param> /// <returns></returns> public bool SaveDetailDS(SupplierManagerUIModel paramModel) { //服务端检查 if (!ServerCheck(paramModel)) { return(false); } #region 保存数据 //将UIModel转为TBModel var argsSupplier = CopyModel <MDLPIS_Supplier>(paramModel); try { //判断主键是否被赋值 if (string.IsNullOrEmpty(argsSupplier.SUPP_ID)) { #region 新增 //生成新ID argsSupplier.SUPP_ID = Guid.NewGuid().ToString(); //主键未被赋值,则执行新增 bool insertSupplierResult = _bll.Insert(argsSupplier); if (!insertSupplierResult) { //新增[供应商]信息失败! ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { MsgParam.ADD + SystemTableEnums.Name.PIS_Supplier }); return(false); } #endregion } else { #region 更新 //主键被赋值,则需要更新,更新需要设定更新条件 argsSupplier.WHERE_SUPP_ID = argsSupplier.SUPP_ID; argsSupplier.WHERE_SUPP_VersionNo = argsSupplier.SUPP_VersionNo; argsSupplier.SUPP_VersionNo++; bool updateSupplierResult = _bll.Update(argsSupplier); if (!updateSupplierResult) { //"更新[供应商]信息失败!" ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { MsgParam.UPDATE + SystemTableEnums.Name.PIS_Supplier }); return(false); } #endregion } } catch (Exception ex) { ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.SAVE, ex.Message }); LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, MethodBase.GetCurrentMethod().ToString(), ex.Message, "", null); return(false); } //将最新数据回写给DetailDS CopyModel(argsSupplier, paramModel); #endregion //刷新供应商缓存 var resultSupplierList = CacheDAX.Get(CacheDAX.ConfigDataKey.AutoPartsSupplier) as List <MDLPIS_Supplier>; List <MDLPIS_Supplier> newSupplierList = new List <MDLPIS_Supplier>(); if (resultSupplierList != null) { newSupplierList = resultSupplierList; if (resultSupplierList.All(x => x.SUPP_ID != argsSupplier.SUPP_ID && x.SUPP_Name != argsSupplier.SUPP_Name)) { newSupplierList.Add(argsSupplier); CacheDAX.Add(CacheDAX.ConfigDataKey.AutoPartsSupplier, newSupplierList, true); } } else { newSupplierList.Add(argsSupplier); CacheDAX.Add(CacheDAX.ConfigDataKey.AutoPartsSupplier, newSupplierList, true); } return(true); }
/// <summary> /// 保存 /// </summary> /// <param name="paramHead">UIModel</param> /// <returns></returns> public bool SaveDetailDS(WarehouseManagerUIModel paramHead, SkyCarBindingList <WarehouseBinManagerUIModel, MDLPIS_WarehouseBin> paramWarehouseBinList) { //服务端检查 if (!ServerCheck(paramHead)) { return(false); } #region 准备数据 #region 仓库 //将UIModel转为TBModel var argsWarehouse = paramHead.ToTBModelForSaveAndDelete <MDLPIS_Warehouse>(); //判断主键是否被赋值 if (string.IsNullOrEmpty(paramHead.WH_ID)) { argsWarehouse.WH_ID = Guid.NewGuid().ToString(); argsWarehouse.WH_CreatedBy = LoginInfoDAX.UserName; argsWarehouse.WH_CreatedTime = BLLCom.GetCurStdDatetime(); } argsWarehouse.WH_UpdatedBy = LoginInfoDAX.UserName; argsWarehouse.WH_UpdatedTime = BLLCom.GetCurStdDatetime(); #endregion #region 仓位 //添加的仓位 if (paramWarehouseBinList != null && paramWarehouseBinList.InsertList != null && paramWarehouseBinList.InsertList.Count > 0) { foreach (var loopDetailItem in paramWarehouseBinList.InsertList) { loopDetailItem.WHB_WH_ID = argsWarehouse.WH_ID ?? argsWarehouse.WHERE_WH_ID; loopDetailItem.WHB_CreatedBy = LoginInfoDAX.UserName; loopDetailItem.WHB_CreatedTime = BLLCom.GetCurStdDatetime(); loopDetailItem.WHB_UpdatedBy = LoginInfoDAX.UserName; loopDetailItem.WHB_UpdatedTime = BLLCom.GetCurStdDatetime(); } } #endregion #endregion #region 带事务的保存 try { DBManager.BeginTransaction(DBCONFIG.Coeus); #region 保存仓库 var saveWarehouseResult = _bll.Save(argsWarehouse, argsWarehouse.WH_ID); if (!saveWarehouseResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.SAVE + SystemTableEnums.Name.PIS_Warehouse }); return(false); } #endregion #region 保存仓位 var saveWarehouseBinResult = _bll.UnitySave(paramWarehouseBinList); if (!saveWarehouseBinResult) { DBManager.RollBackTransaction(DBCONFIG.Coeus); ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.SAVE + SystemTableEnums.Name.PIS_WarehouseBin }); return(false); } #endregion DBManager.CommitTransaction(DBCONFIG.Coeus); } catch (Exception ex) { DBManager.RollBackTransaction(DBCONFIG.Coeus); //保存[仓库]信息发生异常 ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.SAVE, ex.Message }); LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, MethodBase.GetCurrentMethod().ToString(), ex.Message, "", null); return(false); } //将最新数据回写给DetailDS CopyModel(argsWarehouse, paramHead); #endregion #region 刷新缓存 //刷新仓库缓存 var resultWarehouseList = CacheDAX.Get(CacheDAX.ConfigDataKey.Warehouse) as List <MDLPIS_Warehouse>; List <MDLPIS_Warehouse> newWarehouseList = new List <MDLPIS_Warehouse>(); if (resultWarehouseList != null) { newWarehouseList = resultWarehouseList; if (resultWarehouseList.All(x => x.WH_ID != argsWarehouse.WH_ID && x.WH_Name != argsWarehouse.WH_Name)) { newWarehouseList.Add(argsWarehouse); CacheDAX.Add(CacheDAX.ConfigDataKey.Warehouse, newWarehouseList, true); } } else { newWarehouseList.Add(argsWarehouse); CacheDAX.Add(CacheDAX.ConfigDataKey.Warehouse, newWarehouseList, true); } //刷新仓位缓存 if (paramWarehouseBinList == null) { return(true); } var resultWarehouseBinList = CacheDAX.Get(CacheDAX.ConfigDataKey.WarehouseBin) as List <MDLPIS_WarehouseBin>; List <MDLPIS_WarehouseBin> newWarehouseBinList = new List <MDLPIS_WarehouseBin>(); if (resultWarehouseBinList != null) { newWarehouseBinList = resultWarehouseBinList; if (paramWarehouseBinList.InsertList != null && paramWarehouseBinList.InsertList.Count > 0) { foreach (var loopInsertBin in paramWarehouseBinList.InsertList) { if (resultWarehouseBinList.All(x => x.WHB_ID != loopInsertBin.WHB_ID && x.WHB_Name != loopInsertBin.WHB_Name)) { var tempWarehouseBin = new MDLPIS_WarehouseBin(); _bll.CopyModel(loopInsertBin, tempWarehouseBin); newWarehouseBinList.Add(tempWarehouseBin); CacheDAX.Add(CacheDAX.ConfigDataKey.WarehouseBin, newWarehouseBinList, true); } } } if (paramWarehouseBinList.DeleteList != null && paramWarehouseBinList.DeleteList.Count > 0) { //待移除的仓位 List <MDLPIS_WarehouseBin> removeWarehouseBinList = new List <MDLPIS_WarehouseBin>(); foreach (var loopWarehouseBin in newWarehouseBinList) { var deleteWarehouseBin = paramWarehouseBinList.DeleteList.FirstOrDefault(x => x.WHB_ID == loopWarehouseBin.WHB_ID); if (deleteWarehouseBin != null) { removeWarehouseBinList.Add(loopWarehouseBin); } } foreach (var loopWarehouseBin in removeWarehouseBinList) { newWarehouseBinList.Remove(loopWarehouseBin); } } } else { var tempWarehouseBinList = new List <MDLPIS_WarehouseBin>(); _bll.CopyModelList(paramWarehouseBinList.InsertList, tempWarehouseBinList); newWarehouseBinList.AddRange(tempWarehouseBinList); CacheDAX.Add(CacheDAX.ConfigDataKey.WarehouseBin, newWarehouseBinList, true); } #endregion return(true); }