/// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
        /// <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);
        }