Ejemplo n.º 1
0
        public string GetTypeList(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <GetTypeListRP> >();
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var rd = new GetTypeListRD();//返回值

            var          t_TypeBLL = new T_TypeBLL(loggingSessionInfo);
            T_TypeEntity en        = new T_TypeEntity();

            en.customer_id = loggingSessionInfo.ClientID;
            var typeList = t_TypeBLL.QueryByEntity(en, null).Where(p => p.type_code != "OnlineShopping").OrderBy(p => p.type_Level).ToList();

            rd.HasSave = 1;//默认已经保存
            if (typeList != null && typeList.Count != 0)
            {
                int type_Level = (int)typeList[typeList.Count - 1].type_Level;
                //   var userDefineTypeList = typeList.Where(p => p.type_system_flag != 1).ToList();
                if (type_Level == 99)
                // if(userDefineTypeList.Count==0)
                {
                    rd.HasSave = 0;//默认已经保存
                }
            }
            rd.TypeList   = typeList;
            rd.LevelCount = typeList.Count;

            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }
Ejemplo n.º 2
0
 internal void Create(T_TypeEntity dbEntity)
 {
     using (var conn = new SqlConnection(ConnectionString.XgxInsert))
     {
         conn.Open();
         conn.Insert(dbEntity);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 查询角色列表
        /// </summary>
        public string QueryRoleListData()
        {
            var responseData = new ResponseData();
            LoggingSessionInfo loggingSessionInfo = null;

            if (CurrentUserInfo != null)
            {
                loggingSessionInfo = CurrentUserInfo;
            }
            else
            {
                if (string.IsNullOrEmpty(Request("CustomerID")))
                {
                    responseData.success = false;
                    responseData.msg     = "缺少商户标识";
                    return(responseData.ToString());
                }
                else if (string.IsNullOrEmpty(Request("CustomerUserID")))
                {
                    responseData.success = false;
                    responseData.msg     = "缺少登陆员工的标识";
                    return(responseData.ToString());
                }
                else if (string.IsNullOrEmpty(Request("CustomerUserID")))
                {
                    responseData.success = false;
                    responseData.msg     = "缺少登陆员工的标识";
                    return(responseData.ToString());
                }
                else
                {
                    loggingSessionInfo = Default.GetBSLoggingSession(Request("CustomerID"), Request("CustomerUserID"));
                }
            }

            var form = Request("form").DeserializeJSONTo <RoleQueryEntity>();

            var       appSysService = new AppSysService(loggingSessionInfo);//使用兼容模式
            RoleModel list          = new RoleModel();

            string content = string.Empty;
            string key     = string.Empty;

            if (form.app_sys_id != null && form.app_sys_id != string.Empty)
            {
                key = form.app_sys_id.Trim();
            }
            int maxRowCount = PageSize;                          //每页数量
            int limit       = Utils.GetIntVal(Request("limit")); //传过来的参数

            if (limit != 0)
            {
                maxRowCount = PageSize = limit;
            }


            int page = Utils.GetIntVal(Request("page"));//第几页面

            if (page == 0)
            {
                page = 1;
            }
            int startRowIndex = (page - 1) * PageSize + 1;//因为row_number()从1开始


            list = appSysService.GetRolesByAppSysId(key, maxRowCount, startRowIndex
                                                    , form.type_id ?? "", form.role_name ?? "", loggingSessionInfo.UserID);
            //在为用户配置门店角色关系时
            //多加一个参数,在这里选择门店,必须重新加载角色列表,因为创建用户角色门店关系时,角色必须和门店同一个type_level上
            if (!string.IsNullOrEmpty(form.unit_id))
            {
                t_unitBLL    t_unitBll = new t_unitBLL(CurrentUserInfo);
                t_unitEntity t_unitEn  = t_unitBll.GetByID(form.unit_id);

                if (t_unitEn != null)
                {
                    T_TypeBLL    T_TypeBLL = new T_TypeBLL(CurrentUserInfo);
                    T_TypeEntity t_typeEn  = T_TypeBLL.GetByID(t_unitEn.type_id);
                    list.RoleInfoList = list.RoleInfoList.Where(p => p.org_level == t_typeEn.type_Level).ToList();
                }
            }

            var jsonData = new JsonData();

            jsonData.totalCount = list.RoleInfoList.Count.ToString();
            jsonData.data       = list.RoleInfoList;

            content = string.Format("{{\"totalCount\":{1},\"TotalPage\":{2},\"topics\":{0}}}",
                                    list.RoleInfoList.ToJSON(),
                                    list.ICount,
                                    list.TotalPage);
            return(content);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 保存角色
        /// </summary>
        public string SaveRoleData()
        {
            var       roleService  = new RoleService(CurrentUserInfo);
            RoleModel obj          = new RoleModel();
            string    content      = string.Empty;
            string    error        = "";
            var       responseData = new ResponseData();

            string key     = string.Empty;
            string role_id = string.Empty;

            if (Request("role") != null && Request("role") != string.Empty)
            {
                key = Request("role").ToString().Trim();
            }
            if (Request("role_id") != null && Request("role_id") != string.Empty)
            {
                role_id = Request("role_id").ToString().Trim();
            }

            obj = key.DeserializeJSONTo <RoleModel>();

            //obj.Def_App_Id = "";
            //if (Request["app_sys_id"] != null && Request["app_sys_id"] != string.Empty)
            //{
            //    obj.Def_App_Id = Request["app_sys_id"].ToString().Trim();
            //}

            if (role_id.Trim().Length == 0 || role_id == "null" || role_id == "undefined")
            {
                obj.Role_Id = Utils.NewGuid();
            }
            else
            {
                obj.Role_Id = role_id;
            }


            if (obj.type_id == null || obj.type_id.Trim().Length == 0)
            {
                //responseData.success = false;
                //responseData.msg = "所属组织层级不能为空";
                //return responseData.ToJSON();
                obj.type_id   = "";
                obj.org_level = 99;
            }
            else
            {
                T_TypeBLL    typeBll = new T_TypeBLL(CurrentUserInfo);
                T_TypeEntity en      = typeBll.GetByID(obj.type_id);
                if (en != null)
                {
                    obj.org_level = (int)en.type_Level;
                }
            }

            if (obj.Def_App_Id == null || obj.Def_App_Id.Trim().Length == 0)
            {
                responseData.success = false;
                responseData.msg     = "应用系统不能为空";
                return(responseData.ToJSON());
            }

            if (obj.Role_Name == null || obj.Role_Name.Trim().Length == 0)
            {
                responseData.success = false;
                responseData.msg     = "角色名称不能为空";
                return(responseData.ToJSON());
            }

            //根据role_id 获取角色信息,系统保留角色的编码不允许修改,主要是admin、administrator等默认角色
            RoleModel roleOld = new AppSysService(CurrentUserInfo).GetRoleById(CurrentUserInfo, role_id);

            if (roleOld != null && roleOld.Is_Sys == 1)
            {
                //throw (new System.Exception("不能删除系统保留的角色"));
                obj.Role_Code = roleOld.Role_Code;//还用原来的,不用role_name
                obj.Is_Sys    = 1;
            }
            //if (obj.Is_Sys == null)
            //{
            //    responseData.success = false;
            //    responseData.msg = "是否系统保留不能为空";
            //    return responseData.ToJSON();
            //}
            if (obj.Role_Code == null || obj.Role_Code.Trim().Length == 0)
            {
                //responseData.success = false;
                //responseData.msg = "角色编码不能为空";
                //return responseData.ToJSON();
                obj.Role_Code = obj.Role_Name;
            }


            if (obj.RoleMenuInfoList != null)
            {
                foreach (var tmpRoleMenuObj in obj.RoleMenuInfoList)
                {
                    tmpRoleMenuObj.Role_Id = obj.Role_Id;
                }
            }

            obj.Create_Time    = Utils.GetNow();
            obj.Create_User_Id = CurrentUserInfo.CurrentUser.User_Id;
            obj.Modify_Time    = Utils.GetNow();
            obj.Modify_User_id = CurrentUserInfo.CurrentUser.User_Id;
            string strError = "";

            //
            roleService.SetRoleInfo(obj, out strError);
            //
            var menuList = new JIT.CPOS.BS.DataAccess.AppSysService(CurrentUserInfo).GetRoleMenus(CurrentUserInfo.ClientID, obj.Role_Id);

            if (menuList != null && menuList.Count > 0)
            {
                new RedisRoleBLL().SetRole(CurrentUserInfo.ClientID, obj.Role_Id, menuList);
            }
            //roleService.SetRoleInfo(obj, out strError);

            if (strError != "" && strError != "成功")
            {
                responseData.success = false;
                responseData.msg     = strError;
                return(responseData.ToJSON());
            }

            responseData.success = true;
            responseData.msg     = error;

            content = responseData.ToJSON();
            return(content);
        }
Ejemplo n.º 5
0
 public void Create(T_TypeEntity dbEntity)
 {
     _cmd.Create(dbEntity);
 }
Ejemplo n.º 6
0
 public void Delete(T_TypeEntity dbEntity)
 {
     _cmd.Delete(dbEntity);
 }
Ejemplo n.º 7
0
 public void Update(T_TypeEntity dbEntity)
 {
     _cmd.Update(dbEntity);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 设置业务平台客户开户初始化
        /// </summary>
        /// <param name="strCustomerInfo">客户信息字符窜</param>
        /// <param name="strUnitInfo">门店信息字符窜</param>
        /// <param name="typeId">处理类型typeId=1(总部与门店一起处理);typeId=2(只处理总部,不处理门店);typeId=3(只处理门店,不处理总部)</param>
        /// <returns></returns>
        public bool SetBSInitialInfo(string strCustomerInfo, string strUnitInfo, string strMenu, string typeId)
        {
            CustomerInfo customerInfo = new CustomerInfo();

            #region 获取客户信息
            if (!strCustomerInfo.Equals(""))
            {
                customerInfo = (JIT.CPOS.BS.Entity.CustomerInfo)cXMLService.Deserialize(strCustomerInfo, typeof(JIT.CPOS.BS.Entity.CustomerInfo));
                if (customerInfo == null || customerInfo.ID.Equals(""))
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetBSInitialInfo:{0}", "客户不存在或者没有获取合法客户信息")
                    });
                    throw new Exception("客户不存在或者没有获取合法客户信息");
                }
            }
            else
            {
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("SetBSInitialInfo:{0}", "客户信息不存在")
                });
                throw new Exception("客户信息不存在.");
            }
            #endregion
            //获取连接数据库信息
            JIT.CPOS.BS.Entity.User.UserInfo userInfo = new JIT.CPOS.BS.Entity.User.UserInfo();
            LoggingManager     loggingManager         = new cLoggingManager().GetLoggingManager(customerInfo.ID);
            LoggingSessionInfo loggingSessionInfo     = new LoggingSessionInfo();
            loggingSessionInfo.CurrentLoggingManager = loggingManager;
            loggingSessionInfo.CurrentUser           = userInfo;



            #region 判断客户是否已经建立总部
            typeId = "1";//统一作为1来处理
            bool   bReturn   = false;
            string strError  = string.Empty;
            string strReturn = string.Empty;
            // UnitInfo storeInfo = new UnitInfo();

            cUserService userServer = new cUserService(loggingSessionInfo);

            #region 处理用户信息
            userInfo.User_Id          = BaseService.NewGuidPub(); //用户标识
            userInfo.customer_id      = customerInfo.ID;          //客户标识
            userInfo.User_Code        = "admin";
            userInfo.User_Name        = "管理员";
            userInfo.User_Gender      = "1";
            userInfo.User_Password    = "******";
            userInfo.User_Status      = "1";
            userInfo.User_Status_Desc = "正常";
            userInfo.strDo            = "Create";
            #endregion

            #endregion
            UnitInfo unitInfo = new UnitInfo();
            using (TransactionScope scope = new TransactionScope())
            {
                #region 门店

                /**
                 * JIT.CPOS.BS.Entity.UnitInfo unitShopInfo = new JIT.CPOS.BS.Entity.UnitInfo();//门店
                 * if (!strUnitInfo.Equals(""))//把在运营商管理平台创建的门店(code就是商户的code)在这里反序列化
                 * {
                 *  unitShopInfo = (JIT.CPOS.BS.Entity.UnitInfo)cXMLService.Deserialize(strUnitInfo, typeof(JIT.CPOS.BS.Entity.UnitInfo));
                 * }
                 * else
                 * {
                 *  Loggers.Debug(new DebugLogInfo()
                 *  {
                 *      Message = string.Format("SetBSInitialInfo:{0}", "门店信息不存在")
                 *  });
                 *  throw new Exception("门店信息不存在.");
                 * }
                 * **/

                #region 门店是否存在(在这之前门店并没有插入到运营商管理平台的数据库,只是序列化在字符串里)*****

                /**
                 * JIT.CPOS.BS.Entity.UnitInfo unitStoreInfo2 = new JIT.CPOS.BS.Entity.UnitInfo();
                 * try
                 * {
                 *   unitStoreInfo2 = new UnitService(loggingSessionInfo).GetUnitById(unitShopInfo.Id);
                 * }
                 * catch (Exception ex)
                 * {
                 *   Loggers.Debug(new DebugLogInfo()
                 *   {
                 *       Message = string.Format("SetBSInitialInfo:{0}", "获取门店失败")
                 *   });
                 *   throw new Exception("获取门店失败:" + ex.ToString());
                 * }
                 * if (unitStoreInfo2 == null || !string.IsNullOrEmpty(unitStoreInfo2.Id))//***这里的判断是不是错了,应该是(unitStoreInfo2 != null || !string.IsNullOrEmpty(unitStoreInfo2.Id))
                 * {
                 *   Loggers.Debug(new DebugLogInfo()
                 *   {
                 *       Message = string.Format("SetBSInitialInfo:{0}", "门店信息已经存在")
                 *   });
                 *   throw new Exception("门店信息已经存在.");
                 * }
                 * **/
                #endregion
                #endregion

                #region
                //创建商户自己的门店类型
                T_TypeBLL t_TypeBLL = new T_TypeBLL(loggingSessionInfo);
                //创建总部类型
                T_TypeEntity typeGeneral = new T_TypeEntity();
                typeGeneral.type_id          = BaseService.NewGuidPub();//去掉了中间的‘-’
                typeGeneral.type_code        = "总部";
                typeGeneral.type_name        = "总部";
                typeGeneral.type_name_en     = "总部";
                typeGeneral.type_domain      = "UnitType";
                typeGeneral.type_system_flag = 1;
                typeGeneral.status           = 1;
                typeGeneral.type_Level       = 1;
                typeGeneral.customer_id      = customerInfo.ID;
                t_TypeBLL.Create(typeGeneral);
                //创建门店类型
                T_TypeEntity typeShop = new T_TypeEntity();
                typeShop.type_id          = BaseService.NewGuidPub();//去掉了中间的‘-’
                typeShop.type_code        = "门店";
                typeShop.type_name        = "门店";
                typeShop.type_name_en     = "门店";
                typeShop.type_domain      = "UnitType";
                typeShop.type_system_flag = 1;
                typeShop.status           = 1;
                typeShop.type_Level       = 99;//等到在页面上保存时在根据增加的层级来改变他的层级
                typeShop.customer_id      = customerInfo.ID;
                t_TypeBLL.Create(typeShop);

                //创建在线商城类型
                T_TypeEntity typeOnlineShopping = new T_TypeEntity();
                typeOnlineShopping.type_id          = BaseService.NewGuidPub();//去掉了中间的‘-’
                typeOnlineShopping.type_code        = "OnlineShopping";
                typeOnlineShopping.type_name        = "在线商城";
                typeOnlineShopping.type_name_en     = "OnlineShopping";
                typeOnlineShopping.type_domain      = "UnitType";
                typeOnlineShopping.type_system_flag = 1;
                typeOnlineShopping.status           = 1;
                typeOnlineShopping.type_Level       = -99;//在线商城类型不算在组织类型里,因此排在外面
                typeOnlineShopping.customer_id      = customerInfo.ID;
                t_TypeBLL.Create(typeOnlineShopping);


                #endregion

                #region 新建角色

                RoleModel roleInfo = new RoleModel();
                if (typeId.Equals("1"))
                {
                    roleInfo.Role_Id        = BaseService.NewGuidPub();
                    roleInfo.Def_App_Id     = "D8C5FF6041AA4EA19D83F924DBF56F93"; //创建了一个o2o业务系统的角色
                    roleInfo.Role_Code      = "Admin";
                    roleInfo.Role_Name      = "管理员";
                    roleInfo.Role_Eng_Name  = "Admin";
                    roleInfo.Is_Sys         = 1;
                    roleInfo.Status         = 1;
                    roleInfo.customer_id    = customerInfo.ID;
                    roleInfo.Create_User_Id = userInfo.User_Id;
                    roleInfo.Create_Time    = new BaseService().GetCurrentDateTime();
//新加上所处的层级
                    roleInfo.type_id   = typeGeneral.type_id;
                    roleInfo.org_level = (int)typeGeneral.type_Level;//等级

                    string strerror = "";
                    strReturn = new RoleService(loggingSessionInfo).SetRoleInfo(roleInfo, out strerror, false);//这里没有创建他的菜单
                    if (!strReturn.Equals("成功"))
                    {
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("SetBSInitialInfo:{0}", "新建角色失败")
                        });
                        throw new Exception("新建角色失败");
                    }
                    else
                    {
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("SetBSInitialInfo:{0}", "新建角色成功")
                        });
                    }
                }
                #endregion

                #region 角色与流程关系
                if (typeId.Equals("1"))
                {
                    bReturn = new cBillService(loggingSessionInfo).SetBatBillActionRole(roleInfo.Role_Id);//不知道有什么作用
                    if (!bReturn)
                    {
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("SetBSInitialInfo:{0}", "创建角色与流程关系失败")
                        });
                        throw new Exception("创建角色与流程关系失败");
                    }
                    else
                    {
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("SetBSInitialInfo:{0}", "角色与流程关系成功")
                        });
                    }
                }
                #endregion



                //UnitInfo unitInfo = new UnitInfo();
                UnitService unitServer = new UnitService(loggingSessionInfo);
                unitInfo.Id = BaseService.NewGuidPub();//先把总部的标识生成好

                #region 插入用户与角色与客户总部关系
                IList <UserRoleInfo> userRoleInfoList = new List <UserRoleInfo>();
                UserRoleInfo         userRoleInfo     = new UserRoleInfo();//后面要用到总部的信息
                if (typeId.Equals("1") || typeId.Equals("2"))
                {
                    userRoleInfo.Id          = BaseService.NewGuidPub();
                    userRoleInfo.UserId      = userInfo.User_Id;
                    userRoleInfo.RoleId      = roleInfo.Role_Id; //admin角色*****
                    userRoleInfo.UnitId      = unitInfo.Id;      //总部下的***
                    userRoleInfo.Status      = "1";
                    userRoleInfo.DefaultFlag = 1;
                    userRoleInfoList.Add(userRoleInfo);
                }
                loggingSessionInfo.CurrentUserRole = userRoleInfo;//主要是保存总部和员工信息时,会用到
                #region 处理新建客户总部
                if (typeId.Equals("1") || typeId.Equals("2"))
                {
                    //   unitInfo.TypeId = "2F35F85CF7FF4DF087188A7FB05DED1D";//这里要替换成该商户自己的门店类型标识****
                    unitInfo.TypeId = typeGeneral.type_id; //***

                    unitInfo.Code           = "总部";        //customerInfo.Code +
                    unitInfo.Name           = "总部";        // customerInfo.Name +
                    unitInfo.CityId         = customerInfo.city_id;
                    unitInfo.Status         = "1";
                    unitInfo.Status_Desc    = "正常";
                    unitInfo.CustomerLevel  = 1;
                    unitInfo.customer_id    = customerInfo.ID;
                    unitInfo.Parent_Unit_Id = "-99";
                    unitInfo.strDo          = "Create";
                    strReturn = unitServer.SetUnitInfo(loggingSessionInfo, unitInfo, false);
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetBSInitialInfo:{0}", "提交总部:" + strReturn.ToString())
                    });
                }

                #endregion

                #region 处理门店,用的是商户的code和名称,id没有用*****

                /**
                 * storeInfo.Id = unitShopInfo.Id;//(运营商管理平台创建的门店(Shop代表门店***)
                 * if (string.IsNullOrEmpty(unitShopInfo.Id))
                 * {
                 *  storeInfo.Id = BaseService.NewGuidPub();
                 * }
                 * // storeInfo.TypeId = "EB58F1B053694283B2B7610C9AAD2742"; //整个平台的系统类型(门店类型)
                 * storeInfo.TypeId = typeShop.type_id;//上面创建的门店类型
                 * storeInfo.Code = customerInfo.Code;//商户的code
                 * storeInfo.Name = customerInfo.Name;//商户的name
                 * storeInfo.Name = customerInfo.Name;//商户的name
                 *
                 * storeInfo.CityId = customerInfo.city_id;
                 * storeInfo.Status = "1";
                 * storeInfo.Status_Desc = "正常";
                 * storeInfo.CustomerLevel = 1;
                 * storeInfo.customer_id = customerInfo.ID;
                 * storeInfo.Parent_Unit_Id = unitInfo.Id;//总部下面的一个门店
                 * storeInfo.strDo = "Create";
                 * storeInfo.StoreType = "DirectStore";//设置为直营店
                 * strReturn = unitServer.SetUnitInfo(loggingSessionInfo, storeInfo,false);
                 * Loggers.Debug(new DebugLogInfo()
                 * {
                 *  Message = string.Format("SetBSInitialInfo:{0}", "提交门店:" + strReturn.ToString())
                 * });
                 * **/
                #endregion


                //在线商城门店是在存储过程[spBasicSetting]里添加的


                //不建立下面的关系,就可以之保留admin的总部角色权限了

                /**
                 * UserRoleInfo userRoleInfo1 = new UserRoleInfo();
                 * userRoleInfo1.Id = BaseService.NewGuidPub();
                 * userRoleInfo1.UserId = userInfo.User_Id;
                 * userRoleInfo1.RoleId = roleInfo.Role_Id;
                 * userRoleInfo1.UnitId = storeInfo.Id;//还和子门店建立了关系(id为商户的id)
                 * userRoleInfo1.Status = "1";
                 * userRoleInfo1.DefaultFlag = 0;
                 * userRoleInfoList.Add(userRoleInfo1);
                 *  * **/
                bReturn = userServer.SetUserInfo(userInfo, null, out strError, false);                     //保存用户信息(这里会把之前建的会员的角色信息给删除掉),所以要在后面再建立角色和会员的关系
                bReturn = userServer.SetUserRoleTableInfo(loggingSessionInfo, userRoleInfoList, userInfo); //只建立了用户和总部之间的关系
                if (!bReturn)
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetBSInitialInfo:{0}", "新建角色用户门店关系失败")
                    });
                    throw new Exception("新建角色用户门店关系失败");
                }
                else
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetBSInitialInfo:{0}", "新建角色用户门店关系成功")
                    });
                }

                #endregion

                #region 处理用户信息

                if (typeId.Equals("1"))
                {
                    /**
                     * IList<UserRoleInfo> userRoleInfos = new List<UserRoleInfo>();
                     * UserRoleInfo userRoleInfo = new UserRoleInfo();
                     * userRoleInfo.Id = BaseService.NewGuidPub();
                     * userRoleInfo.RoleId = roleInfo.Role_Id;// 加上管理员权限
                     * userRoleInfo.UserId = userInfo.User_Id;
                     * userRoleInfo.UnitId = unitShopInfo.Id;//新建的门店标识(运营商管理平台创建的门店(Shop代表门店***),code=customer_code,name=customer_name)
                     * userRoleInfos.Add(userRoleInfo);
                     * loggingSessionInfo.CurrentUserRole = userRoleInfo;
                     * **/


                    //先给admin键了一个门店的权限*****,可以给去掉,去掉上面一句话就可以了****

                    if (!bReturn)
                    {
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("SetBSInitialInfo:{0}", "保存用户失败")
                        });
                        throw new Exception("保存用户失败");
                    }
                    else
                    {
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("SetBSInitialInfo:{0}", "保存用户成功")
                        });
                    }
                }

                #endregion



                #region 添加仓库以及仓库与门店关系

                /**
                 * JIT.CPOS.BS.Entity.Pos.WarehouseInfo warehouseInfo = new JIT.CPOS.BS.Entity.Pos.WarehouseInfo();
                 * warehouseInfo.warehouse_id = BaseService.NewGuidPub();
                 * warehouseInfo.wh_code = storeInfo.Code + "_wh";//建立了刚才见的子门点的仓库
                 * warehouseInfo.wh_name = storeInfo.Name + "仓库";
                 * warehouseInfo.is_default = 1;
                 * warehouseInfo.wh_status = 1;
                 * warehouseInfo.CreateUserID = userInfo.User_Id;
                 * warehouseInfo.CreateTime = Convert.ToDateTime(new BaseService().GetCurrentDateTime());
                 * warehouseInfo.CreateUserName = userInfo.User_Name;
                 * warehouseInfo.Unit = storeInfo;
                 *
                 * PosService posService = new PosService(loggingSessionInfo);
                 * bReturn = posService.InsertWarehouse(warehouseInfo,false);
                 * if (!bReturn)
                 * {
                 *  Loggers.Debug(new DebugLogInfo()
                 *  {
                 *      Message = string.Format("SetBSInitialInfo:{0}", "新建仓库失败")
                 *  });
                 *  throw new Exception("新建仓库失败");
                 * }
                 * else {
                 *  Loggers.Debug(new DebugLogInfo()
                 *  {
                 *      Message = string.Format("SetBSInitialInfo:{0}", "新建仓库成功")
                 *  });
                 * }
                 * **/
                #endregion

                #region 设置菜单信息
                //在存储过程里初始化了

                /***
                 * if (typeId.Equals("1") || typeId.Equals("2"))
                 * {
                 *  if (!strMenu.Equals(""))
                 *  {
                 *      CMenuService menuServer = new CMenuService(loggingSessionInfo);
                 *      bReturn = new CMenuService(loggingSessionInfo).SetMenuInfo(strMenu, customerInfo.ID, false);
                 *      if (!bReturn) {
                 *          Loggers.Debug(new DebugLogInfo()
                 *          {
                 *              Message = string.Format("SetBSInitialInfo:{0}", "新建菜单失败")
                 *          });
                 *          throw new Exception("新建菜单失败"); }
                 *      else {
                 *          Loggers.Debug(new DebugLogInfo()
                 *          {
                 *              Message = string.Format("SetBSInitialInfo:{0}", "新建菜单成功")
                 *          });
                 *      }
                 *  }
                 * }
                 * **/
                #endregion

                #region 20131127设置固定标签
                TagsBLL tagsServer  = new TagsBLL(loggingSessionInfo);
                bool    bReturnTags = tagsServer.setCopyTag(customerInfo.ID);
                #endregion

                scope.Complete();
                scope.Dispose();
            }

            #region 管理平台--插入客户下的用户信息
            if (typeId.Equals("1"))
            {
                if (!new cUserService(loggingSessionInfo).SetManagerExchangeUserInfo(loggingSessionInfo, userInfo, 1))
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetBSInitialInfo:{0}", "提交管理平台用户信息失败")
                    });
                    strError = "提交管理平台失败";
                    bReturn  = false;
                    return(bReturn);
                }
                else
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetBSInitialInfo:{0}", "提交管理平台用户信息成功")
                    });
                }
            }
            #endregion

            #region 管理平台--插入客户下的门店信息(只是提交门店级别的)

            //  bReturn = new UnitService(loggingSessionInfo).SetManagerExchangeUnitInfo(loggingSessionInfo, storeInfo, 1);
            bReturn = new UnitService(loggingSessionInfo).SetManagerExchangeUnitInfo(loggingSessionInfo, unitInfo, 1);
            if (!bReturn)
            {
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("SetBSInitialInfo:{0}", "门店插入管理平台失败")
                });
                throw new Exception("门店插入管理平台失败");
            }
            else
            {
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("SetBSInitialInfo:{0}", "门店插入管理平台成功")
                });
            }


            #endregion

            #region 中间层--插入用户,客户关系
            if (typeId.Equals("1"))
            {
                userInfo.customer_id = customerInfo.ID;
                string strResult = cUserService.SetDexUserCertificate(loggingSessionInfo, userInfo);
                if (!(strResult.Equals("True") || strResult.Equals("true")))
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetBSInitialInfo:{0}", "插入SSO失败")
                    });
                    strError = "插入SSO失败";
                    bReturn  = false;
                    return(bReturn);
                }
                else
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetBSInitialInfo:{0}", "插入SSO成功")
                    });
                }
            }
            #endregion

            return(true);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(T_TypeEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(T_TypeEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <T_TypeEntity> PagedQueryByEntity(T_TypeEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public T_TypeEntity[] QueryByEntity(T_TypeEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Delete(T_TypeEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Delete(pEntity, pTran);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(T_TypeEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Update(T_TypeEntity pEntity)
 {
     _currentDAO.Update(pEntity);
 }