protected override GetCustomerModuleMappingRD ProcessRequest(APIRequest <GetCustomerModuleMappingRP> pRequest)
        {
            GetCustomerModuleMappingRD rd = new GetCustomerModuleMappingRD();

            var userInfo = this.CurrentUserInfo;

            userInfo.CurrentLoggingManager.Connection_String = System.Configuration.ConfigurationManager.AppSettings["Conn_ap"];
            CustomerModuleMappingBLL    bll    = new CustomerModuleMappingBLL(userInfo);
            CustomerModuleMappingEntity entity = new CustomerModuleMappingEntity();

            entity.CustomerID = pRequest.Parameters.CustomerId;
            var list = bll.QueryByEntity(entity, null);
            var temp = new List <string> {
            };

            if (list != null)
            {
                foreach (var item in list)
                {
                    string customerMapping = item.VocaVerMappingID.ToString();
                    temp.Add(customerMapping);
                }
                rd.CustomerModuleMapping = temp.ToArray();
            }
            return(rd);
        }
Beispiel #2
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(CustomerModuleMappingEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }
Beispiel #3
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(CustomerModuleMappingEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
Beispiel #4
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <CustomerModuleMappingEntity> PagedQueryByEntity(CustomerModuleMappingEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
Beispiel #5
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public CustomerModuleMappingEntity[] QueryByEntity(CustomerModuleMappingEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
Beispiel #6
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(CustomerModuleMappingEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }
        protected override SetCustomerModuleMappingRD ProcessRequest(APIRequest <SetCustomerModuleMappingRP> pRequest)
        {
            SetCustomerModuleMappingRD rd = new SetCustomerModuleMappingRD();
            var para = pRequest.Parameters;

            //获取当前商户的数据库链接信息
            var customerCurrentUserInfo = this.CurrentUserInfo;

            if (string.IsNullOrEmpty(this.CurrentUserInfo.Conn))
            {
                customerCurrentUserInfo = Default.GetBSLoggingSession(para.CustomerID, "system");
            }

            //获取主库数据库链接信息
            var userInfo = this.CurrentUserInfo;

            userInfo.CurrentLoggingManager.Connection_String = System.Configuration.ConfigurationManager.AppSettings["Conn_ap"];
            CustomerModuleMappingBLL    bll    = new CustomerModuleMappingBLL(userInfo);
            CustomerModuleMappingEntity entity = new CustomerModuleMappingEntity();

            SysVocationVersionMappingBLL vocationVersionMappingBLL = new SysVocationVersionMappingBLL(userInfo); //行业版本关系业务逻辑层
            T_MenuBLL menuBLL = new T_MenuBLL(customerCurrentUserInfo);                                          //菜单业务逻辑层


            string strArrVocaverMappingID = para.VocaVerMappingID.ToString();
            // string[] strArrVocaverMappingID = str.Split(',');
            var tran = bll.GetTran();

            using (tran.Connection)
            {
                try
                {
                    //for (int i = 0; i < strArrVocaverMappingID.Length; i++)
                    //{
                    //var tempList = bll.QueryByEntity(new CustomerModuleMappingEntity { CustomerID = para.CustomerID, VocaVerMappingID = Guid.Parse(strArrVocaverMappingID[i].ToString()) }, null);  //之前是判断只有一个套餐。现在可以有多个套餐
                    if (strArrVocaverMappingID.Contains(','))
                    {
                        throw new APIException(string.Format("不能应用到多个套餐。"))
                              {
                                  ErrorCode = 301
                              };
                    }
                    else
                    {
                        var tempList = bll.QueryByEntity(new CustomerModuleMappingEntity {
                            CustomerID = para.CustomerID
                        }, null);
                        if (tempList.Length > 0)  //如果存在该客户的信息。则更新
                        {
                            string MappingId = tempList[0].MappingID.ToString();
                            entity                  = new CustomerModuleMappingEntity();
                            entity.MappingID        = Guid.Parse(MappingId);
                            entity.VocaVerMappingID = Guid.Parse(strArrVocaverMappingID.ToString());
                            entity.CustomerID       = para.CustomerID;
                            bll.Update(entity);
                        }
                        else
                        {
                            entity                  = new CustomerModuleMappingEntity();
                            entity.MappingID        = Guid.NewGuid();
                            entity.VocaVerMappingID = Guid.Parse(strArrVocaverMappingID.ToString());
                            entity.CustomerID       = para.CustomerID;
                            bll.Create(entity);
                        }
                    }

                    /////针对集客宝版本,更新CustomerEx中的限制门店数(建仙代码,稍后他合并上来)
                    var bllAPCommon = new APCommonBLL(userInfo);
                    bllAPCommon.UpdateCustomerEx(para.CustomerID, userInfo.CurrentLoggingManager.User_Name);
                    ////}

                    //更新菜单和可操作权限
                    var vocationVersionMappingInfo = vocationVersionMappingBLL.GetByID(para.VocaVerMappingID);
                    if (vocationVersionMappingInfo != null)
                    {
                        if (vocationVersionMappingInfo.VersionID != 3)//版本不等于集客宝版本时更新
                        {
                            //批量修改菜单操作权限
                            menuBLL.UpdateIsCanAccess(para.CustomerID);
                            //设置隐藏的菜单可用(紧急方案:集客宝中只包含发送通知隐藏)
                            menuBLL.UpgradeMenu(para.CustomerID, vocationVersionMappingInfo.VocaVerMappingID.ToString());
                        }
                    }
                    tran.Commit();
                }
                catch (Exception ex)
                {
                    tran.Rollback();//回滚事物

                    throw new APIException(ex.Message);
                }
            }
            return(rd);
        }