public bool SetItemDownloadLog(ItemDownloadLogEntity info, out string strError)
 {
     try
     {
         var itemDownloadList = _currentDAO.QueryByEntity(new ItemDownloadLogEntity()
         {
             ItemId   = info.ItemId
             , UserId = info.UserId
         }, null);
         if (itemDownloadList == null || itemDownloadList.Length == 0)
         {
             info.LogId = BaseService.NewGuidPub();
             info.Count = 1;
             _currentDAO.Create(info);
         }
         else
         {
             var itemDownloadInfo = itemDownloadList[0];
             itemDownloadInfo.Count          = itemDownloadInfo.Count + 1;
             itemDownloadInfo.LastUpdateTime = info.LastUpdateTime;
             _currentDAO.Update(itemDownloadInfo);
         }
         strError = "成功";
         return(true);
     }
     catch (Exception ex) {
         strError = ex.ToString();
         return(false);
     }
 }
Beispiel #2
0
        /// <summary>
        /// 活动报名表数据提交
        /// </summary>
        public GetResponseParams <bool> WEventSubmitEventApply(string EventID, string UserID,
                                                               WEventUserMappingEntity userMappingEntity, IList <QuesAnswerEntity> quesAnswerList)
        {
            #region 判断对象不能为空
            if (EventID == null || EventID.ToString().Equals(""))
            {
                return(new GetResponseParams <bool>
                {
                    Flag = "0",
                    Code = "419",
                    Description = "活动标识为空",
                });
            }
            #endregion

            GetResponseParams <bool> response = new GetResponseParams <bool>();
            response.Flag        = "1";
            response.Code        = "200";
            response.Description = "成功";
            try
            {
                var quesAnswerBLL = new QuesAnswerBLL(CurrentUserInfo);

                // WEventUserMapping
                var wEventUserMappingBLL = new WEventUserMappingBLL(CurrentUserInfo);
                //if (!wEventUserMappingBLL.ExsitWEventUserMapping(userMappingEntity))
                //{
                userMappingEntity.Mapping = Common.Utils.NewGuid();
                userMappingEntity.EventID = EventID;
                userMappingEntity.UserID  = UserID;
                wEventUserMappingBLL.Create(userMappingEntity);
                //}

                // QuesAnswer
                if (quesAnswerList != null)
                {
                    //根据活动删除所有已有答案
                    bool   bRetun   = quesAnswerBLL.DeleteQuesAnswerByEventID(EventID, UserID);
                    string createBy = BaseService.NewGuidPub();
                    foreach (var quesAnswerItem in quesAnswerList)
                    {
                        quesAnswerBLL.SubmitQuesQuestionAnswerWEvent(userMappingEntity.UserID,
                                                                     quesAnswerItem.QuestionID, quesAnswerItem.QuestionValue, createBy);
                    }
                }
                //int iBool = _currentDAO.SetEventApplyCount(EventID, UserID);
                response.Params = true;
                return(response);
            }
            catch (Exception ex)
            {
                response.Flag        = "0";
                response.Code        = "103";
                response.Description = "失败";//+ ":" + ex.ToString();
                return(response);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 客户认证是否存在
        /// </summary>
        /// <param name="OpenId"></param>
        /// <param name="CustomerId"></param>
        /// <param name="strError"></param>
        /// <returns></returns>
        public VipEntity SetVipLegalize(string OpenId, string CustomerId, string SalesAmount, out string strError)
        {
            string    strNo   = string.Empty;
            VipEntity vipInfo = new VipEntity();

            try
            {
                VipBLL vipServer = new VipBLL(this.CurrentUserInfo);
                //从总部获取信息
                bool bReturn = vipServer.GetVipInfoFromApByOpenId(OpenId, null);
                if (bReturn)
                {
                    //获取当前最大值
                    int No = _currentDAO.GetMaxNo(CustomerId);
                    #region 插入本次信息
                    WLegalizeEntity info = new WLegalizeEntity();
                    info.LegalizeId   = BaseService.NewGuidPub();
                    info.OpenId       = OpenId;
                    info.CustomerId   = CustomerId;
                    info.CreateBy     = OpenId;
                    info.LastUpdateBy = OpenId;
                    info.No           = No;
                    info.SalesAmount  = Convert.ToDecimal(SalesAmount);
                    Create(info);
                    #endregion
                    strNo = No.ToString();
                    #region
                    VipEntity[] vipObj = { };
                    vipObj = vipServer.QueryByEntity(new VipEntity()
                    {
                        WeiXinUserId = OpenId
                    }, null);
                    if (vipObj != null && vipObj.Length > 0 && vipObj[0] != null)
                    {
                        vipInfo = vipObj[0];
                        vipInfo.SerialNumber = strNo;
                        strError             = "OK";
                    }
                    else
                    {
                        strError = "您还不未关注微信账号</br>请联系门店工作人员!";
                    }
                    #endregion
                }
                else
                {
                    strError = "获取总部数据出错,请找管理员帮助.";
                }
            }
            catch (Exception ex) {
                strError = ex.ToString();
            }
            return(vipInfo);
        }
Beispiel #4
0
        /// <summary>
        /// 客户下完订单之后,系统处理微信推送
        /// </summary>
        /// <param name="OrderId">订单标识</param>
        /// <param name="msgUrl">微信推送地址</param>
        /// <param name="distance">距离</param>
        /// <param name="strError">错误提示</param>
        /// <returns></returns>
        public bool SetPushOrder(string OrderId, string msgUrl, float distance, out string strError)
        {
            string content = string.Empty;

            try
            {
                DataSet           ds          = new DataSet();
                IList <VipEntity> vipListInfo = new List <VipEntity>();
                ds = _currentDAO.GetFieldwork(distance, OrderId);
                if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    vipListInfo = DataTableToObject.ConvertToList <VipEntity>(ds.Tables[0]);
                    foreach (VipEntity vipInfo in vipListInfo)
                    {
                        var orderInfo = GetByID(OrderId);
                        //string msgUrl = ConfigurationManager.AppSettings["push_weixin_msg_url"].Trim();
                        //string msgText = string.Format("信息提示用户。{0}分钟内,工号为{1}的员工将上门收取衣物,该员工的手机号为{2}",
                        //   "5", vipInfo.VipCode, vipInfo.Phone);
                        Random rad = new Random();
                        //string msgText = "您有一个订单,<a href='http://o2oapi.aladingyidong.com/wap/xiyi/sureOrder.html?rid="+rad.Next(1000,100000)+"&customerId=" + this.CurrentUserInfo..Customer_Id + "&orderId=" + OrderId + "&userId=" + vipInfo.VIPID + "&openId=" + vipInfo.WeiXinUserId + "&address=" + HttpUtility.UrlEncode(orderInfo.Address) + "&phone=" + orderInfo.Phone + "&Cnumber=" + orderInfo.Qty + "&status="+orderInfo.Status+"'>点击确认订单.</a>";
                        string msgText = "您有一个订单,<a href='http://o2oapi.aladingyidong.com/wap/xiyi/sureOrder.html?rid=" + rad.Next(1000, 100000) + "&customerId=" + this.CurrentUserInfo.CurrentUser.customer_id + "&orderId=" + OrderId + "&userId=" + vipInfo.VIPID + "&openId=" + vipInfo.WeiXinUserId + "'>点击确认订单.</a>";
                        string msgData = "<xml><OpenID><![CDATA[" + vipInfo.WeiXinUserId + "]]></OpenID><Content><![CDATA[" + msgText + "]]></Content></xml>";

                        var msgResult = Common.Utils.GetRemoteData(msgUrl, "POST", msgData);
                        #region 发送日志
                        MarketSendLogBLL    logServer = new MarketSendLogBLL(CurrentUserInfo);
                        MarketSendLogEntity logInfo   = new MarketSendLogEntity();
                        logInfo.LogId           = BaseService.NewGuidPub();
                        logInfo.IsSuccess       = 1;
                        logInfo.MarketEventId   = OrderId;
                        logInfo.SendTypeId      = "2";
                        logInfo.TemplateContent = msgData;
                        logInfo.VipId           = vipInfo.VIPID;
                        logInfo.WeiXinUserId    = vipInfo.WeiXinUserId;
                        logInfo.CreateTime      = System.DateTime.Now;
                        logServer.Create(logInfo);
                        #endregion
                    }
                }
                strError = "成功";
                return(true);
            }
            catch (Exception ex) {
                strError = ex.ToString();
                return(false);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 设置收藏
 /// </summary>
 /// <param name="ItemId"></param>
 /// <param name="ItemKeepStatus"></param>
 /// <param name="UserId"></param>
 /// <param name="strError"></param>
 /// <returns></returns>
 public bool SetItemKeep(string ItemId, string ItemKeepStatus, string UserId, out string strError)
 {
     try
     {
         ItemKeepEntity itemKeepInfo = new ItemKeepEntity();
         //1.判断是否存在
         var itemKeepInfoList = _currentDAO.QueryByEntity(new ItemKeepEntity()
         {
             ItemId  = ItemId
             , VipId = UserId
         }, null);
         if (itemKeepInfoList == null || itemKeepInfoList.Length == 0)
         {
             itemKeepInfo.ItemKeepId     = BaseService.NewGuidPub();
             itemKeepInfo.ItemId         = ItemId;
             itemKeepInfo.KeepStatus     = Convert.ToInt32(ItemKeepStatus);
             itemKeepInfo.CreateBy       = UserId;
             itemKeepInfo.LastUpdateBy   = UserId;
             itemKeepInfo.CreateTime     = System.DateTime.Now;
             itemKeepInfo.LastUpdateTime = System.DateTime.Now;
             itemKeepInfo.VipId          = UserId;
             _currentDAO.Create(itemKeepInfo);
         }
         else
         {
             itemKeepInfo            = itemKeepInfoList[0];
             itemKeepInfo.KeepStatus = Convert.ToInt32(ItemKeepStatus);
             if (itemKeepInfo.VipId == null || itemKeepInfo.VipId.Equals(""))
             {
                 itemKeepInfo.VipId = UserId;
             }
             _currentDAO.Update(itemKeepInfo);
         }
         strError = "收藏成功";
         return(true);
     }
     catch (Exception ex) {
         strError = ex.ToString();
         return(false);
     }
 }
Beispiel #6
0
 /// <summary>
 /// 原链接换成短连接
 /// </summary>
 /// <param name="OldUrl">原链接</param>
 /// <param name="ShortUrl">返回短连接</param>
 /// <param name="strError">返回提示</param>
 /// <returns>是否成功</returns>
 public bool SetShortUrlChange(string OldUrl, out string ShortUrl, out string strError)
 {
     ShortUrl = string.Empty;
     try
     {
         if (OldUrl == null || OldUrl.Trim().Equals(""))
         {
             strError = "原链接不能为空";
             return(false);
         }
         ShortUrlChangeEntity         changeInfo   = new ShortUrlChangeEntity();
         IList <ShortUrlChangeEntity> shortUrlList = QueryByEntity(new ShortUrlChangeEntity
         {
             OldUrl = OldUrl
         }, null);
         if (shortUrlList == null || shortUrlList.Count == 0 || shortUrlList[0].ShortUrl == null || shortUrlList[0].ShortUrl.Equals(""))
         {
             ShortUrl               = "http://o2oapi.aladingyidong.com/t.aspx?" + GenerateRandom(6);
             changeInfo.ChangeId    = BaseService.NewGuidPub();
             changeInfo.AccessCount = 1;
             changeInfo.ChangeCount = 0;
             changeInfo.OldUrl      = OldUrl;
             changeInfo.ShortUrl    = ShortUrl;
             Create(changeInfo);
         }
         else
         {
             changeInfo             = shortUrlList[0];
             changeInfo.AccessCount = changeInfo.AccessCount + 1;
             Update(changeInfo, false);
         }
         strError = "成功.";
         ShortUrl = changeInfo.ShortUrl;
         return(true);
     }
     catch (Exception ex) {
         strError = ex.ToString();
         return(false);
     }
 }
Beispiel #7
0
        /// <summary>
        /// 确认收单,并且推送消息告知客户
        /// </summary>
        /// <param name="orderId">确认单据</param>
        /// <param name="userId">收单确认人</param>
        /// <returns></returns>
        public bool GetReceiptConfirm(string orderId, string userId, string msgUrl, out string strError)
        {
            try
            {
                DataSet ds = new DataSet();
                ds = _currentDAO.GetReceiptConfirm(orderId, userId);
                VipEntity vipInfo = new VipEntity();
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    vipInfo = DataTableToObject.ConvertToObject <VipEntity>(ds.Tables[0].Rows[0]);
                    string msgText = string.Format("信息提示用户。{0}分钟内,工号为{1}的员工将上门收取衣物,该员工的手机号为{2}", "30", vipInfo.VipCode, vipInfo.Phone);
                    string msgData = "<xml><OpenID><![CDATA[" + vipInfo.WeiXinUserId + "]]></OpenID><Content><![CDATA[" + msgText + "]]></Content></xml>";

                    var msgResult = Common.Utils.GetRemoteData(msgUrl, "POST", msgData);
                    #region 发送日志
                    MarketSendLogBLL    logServer = new MarketSendLogBLL(CurrentUserInfo);
                    MarketSendLogEntity logInfo   = new MarketSendLogEntity();
                    logInfo.LogId           = BaseService.NewGuidPub();
                    logInfo.IsSuccess       = 1;
                    logInfo.MarketEventId   = orderId;
                    logInfo.SendTypeId      = "2";
                    logInfo.TemplateContent = msgData;
                    logInfo.VipId           = vipInfo.VIPID;
                    logInfo.WeiXinUserId    = vipInfo.WeiXinUserId;
                    logInfo.CreateTime      = System.DateTime.Now;
                    logServer.Create(logInfo);
                    #endregion
                }
                strError = "";
                return(true);
            }
            catch (Exception ex) {
                strError = ex.ToString();
                return(false);
            }
        }
Beispiel #8
0
        /// <summary>
        /// 品牌信息同步
        /// </summary>
        /// <param name="BrandId">品牌唯一码</param>
        /// <param name="BrandName">品牌名称</param>
        /// <param name="DataFrom">来源1=brandDetail,2=prop</param>
        /// <param name="IsDelete">是否删除1=是,0=否</param>
        /// <returns></returns>
        public bool SetBrandAndPropSyn(string BrandId, string BrandName, int DataFrom, int IsDelete, out string strError)
        {
            bool bReturn = true;

            try
            {
                #region
                if (BrandId == null || BrandId.Trim().Equals(""))
                {
                    strError = "品牌唯一码为空";
                    return(false);
                }
                if (BrandName == null || BrandName.Trim().Equals(""))
                {
                    strError = "品牌名称为空";
                    return(false);
                }
                #endregion
                #region 修改属性
                if (DataFrom == 1)
                {
                    PropService propService = new PropService(this.CurrentUserInfo);
                    PropInfo    propInfo    = new PropInfo();
                    propInfo = propService.GetPropInfoById(BrandId);
                    if (propInfo == null || propInfo.Prop_Id == null || propInfo.Prop_Id.Equals(""))
                    {
                        propInfo.Prop_Id        = BrandId;
                        propInfo.Prop_Code      = BrandName;
                        propInfo.Prop_Name      = BrandName;
                        propInfo.Prop_Eng_Name  = BrandName;
                        propInfo.Prop_Type      = "3";
                        propInfo.Parent_Prop_id = "F8823C2EBACF4965BA134D3B10BD0B9F";
                        propInfo.Prop_Level     = 3;
                        propInfo.Prop_Domain    = "ITEM";
                        propInfo.Prop_Status    = 1;
                        propInfo.Display_Index  = 10;
                        propInfo.Create_Time    = BaseService.NewGuidPub();
                        propInfo.Create_User_Id = this.CurrentUserInfo.CurrentUser.User_Id;
                        propInfo.Modify_Time    = BaseService.NewGuidPub();
                        propInfo.Modify_User_Id = this.CurrentUserInfo.CurrentUser.User_Id;
                        strError = "新建属性品牌信息出错";
                        bReturn  = propService.SaveProp(propInfo, ref strError);
                    }
                    else
                    {
                        propInfo.Prop_Code      = BrandName;
                        propInfo.Prop_Name      = BrandName;
                        propInfo.Prop_Eng_Name  = BrandName;
                        propInfo.Modify_Time    = BaseService.NewGuidPub();
                        propInfo.Modify_User_Id = this.CurrentUserInfo.CurrentUser.User_Id;
                        propInfo.Prop_Status    = 1;
                        bReturn = propService.UpdateProp(propInfo);
                    }
                }
                #endregion

                #region 修改品牌
                if (DataFrom == 2)
                {
                    BrandDetailEntity brandInfo = new BrandDetailEntity();
                    brandInfo = GetByID(BrandId);
                    if (brandInfo == null || brandInfo.BrandId == null || brandInfo.BrandId.Trim().Equals(""))
                    {
                        BrandDetailEntity brandInfo1 = new BrandDetailEntity();
                        brandInfo1.BrandId      = BrandId;
                        brandInfo1.BrandCode    = BrandName;
                        brandInfo1.BrandName    = BrandName;
                        brandInfo1.BrandEngName = BrandName;
                        brandInfo1.CustomerId   = this.CurrentUserInfo.CurrentUser.customer_id;
                        Create(brandInfo1);
                    }
                    else
                    {
                        brandInfo.BrandCode    = BrandName;
                        brandInfo.BrandName    = BrandName;
                        brandInfo.BrandEngName = BrandName;
                        brandInfo.CustomerId   = this.CurrentUserInfo.CurrentUser.customer_id;
                        Update(brandInfo, false);
                    }
                }
                #endregion

                strError = "成功";
                return(bReturn);
            }
            catch (Exception ex) {
                strError = ex.ToString();
                return(false);
            }
        }
Beispiel #9
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);
        }
Beispiel #10
0
        public bool SetEventWXPush(LEventsEntity eventInfo, string WeiXin, string OpenId, string VipId, string msgUrl, out string strError, string AuthUrl, int iRad)
        {
            try
            {
                MarketSendLogBLL logServer = new MarketSendLogBLL(this.CurrentUserInfo);
                Random           rad       = new Random();
                if (eventInfo == null || eventInfo.ModelId == null || eventInfo.ModelId.Equals(""))
                {
                    strError = "获取信息不全,缺少模板。";
                    return(false);
                }
                #region
                WEventUserMappingBLL eventUserMapping = new WEventUserMappingBLL(CurrentUserInfo);
                int eventPersonCount = 0;
                eventPersonCount = eventUserMapping.GetEventSignInCount(eventInfo.EventID);


                #endregion
                WApplicationInterfaceBLL wAServer = new WApplicationInterfaceBLL(this.CurrentUserInfo);
                var wxArray = wAServer.QueryByEntity(new WApplicationInterfaceEntity
                {
                    WeiXinID = WeiXin
                    ,
                    IsDelete = 0
                    ,
                    CustomerId = this.CurrentUserInfo.CurrentUser.customer_id
                }, null);
                if (wxArray == null || wxArray.Length == 0 || wxArray[0].AppID == null || wxArray[0].AppID.Equals(""))
                {
                    strError = "不存在对应的微信帐号";
                    return(false);
                }
                else
                {
                    WApplicationInterfaceEntity wxInfo = wxArray[0];
                    WX.CommonBLL server = new WX.CommonBLL();
                    JIT.CPOS.BS.Entity.WX.SendMessageEntity sendMessageInfo = new Entity.WX.SendMessageEntity();

                    WMaterialTextBLL            wTextServer = new WMaterialTextBLL(this.CurrentUserInfo);
                    IList <WMaterialTextEntity> textlist    = new List <WMaterialTextEntity>();
                    textlist = wTextServer.GetMaterialTextListByModelId(eventInfo.ModelId);

                    if (textlist != null && textlist.Count > 0 && textlist[0].TextId != null)
                    {
                        #region
                        VipBLL    vipServer = new VipBLL(CurrentUserInfo);
                        VipEntity vipInfo   = vipServer.GetByID(VipId);
                        sendMessageInfo.msgtype = "news";
                        sendMessageInfo.touser  = OpenId;
                        List <JIT.CPOS.BS.Entity.WX.NewsEntity> newsList = new List <JIT.CPOS.BS.Entity.WX.NewsEntity>();
                        foreach (var info in textlist)
                        {
                            JIT.CPOS.BS.Entity.WX.NewsEntity newsInfo = new Entity.WX.NewsEntity();
                            newsInfo.title = info.Title;
                            if (vipInfo != null && !vipInfo.VIPID.Equals(""))
                            {
                                newsInfo.description = info.Author.Replace("#VIPNAME#", vipInfo.VipName);
                            }
                            else
                            {
                                newsInfo.description = info.Author;
                            }

                            newsInfo.description = newsInfo.description.Replace("#PERSONCOUNT#", Convert.ToString(eventPersonCount));
                            //string url = info.OriginalUrl;
                            //JIT.Utility.Log.Loggers.Debug(new DebugLogInfo()
                            //{
                            //    Message = string.Format("处理原文链接出错:{0},url:{1};Status:{2};",)
                            //});
                            if (info.OriginalUrl != null && !info.OriginalUrl.Equals("") && vipInfo.Status != null && !vipInfo.Status.ToString().Equals(""))
                            {
                                if (vipInfo.Status.Equals(1) && info.OriginalUrl.IndexOf("Fuxing") > 0)
                                {
                                    newsInfo.description = info.Text;
                                }
                                else
                                {
                                }
                            }

                            if (info.OriginalUrl.IndexOf("?") > 0)
                            {
                                newsInfo.url = info.OriginalUrl + "&rnd=" + rad.Next(1000, 100000) + "";
                            }
                            else
                            {
                                string goUrl = info.OriginalUrl + "?1=1&applicationId=" + wxInfo.ApplicationId + "&eventId=" + eventInfo.EventID + "&openId=" + OpenId + "&userId=" + VipId + "";
                                goUrl = HttpUtility.UrlEncode(goUrl);

                                newsInfo.url = AuthUrl + "OnlineClothing/go.htm?customerId=" + this.CurrentUserInfo.CurrentUser.customer_id
                                               + "&applicationId=" + wxInfo.ApplicationId
                                               + "&openId=" + OpenId
                                               + "&userId=" + VipId
                                               + "&backUrl=" + goUrl + "";
                            }
                            //OnlineClothing/go.htm?customerId=" + customerId + "&openId=" + OpenId + "&userId=" + vipId + "&backUrl=" + HttpUtility.UrlEncode(goUrl) + "";
                            newsInfo.picurl = info.CoverImageUrl;
                            newsList.Add(newsInfo);
                        }
                        sendMessageInfo.articles = newsList;
                        #endregion
                        #region 发送日志

                        MarketSendLogEntity logInfo1 = new MarketSendLogEntity();
                        logInfo1.LogId         = BaseService.NewGuidPub();
                        logInfo1.IsSuccess     = 1;
                        logInfo1.MarketEventId = eventInfo.EventID;
                        logInfo1.SendTypeId    = "2";
                        logInfo1.Phone         = iRad.ToString();
                        if (sendMessageInfo.ToJSON().ToString().Length > 2000)
                        {
                            logInfo1.TemplateContent = sendMessageInfo.ToJSON().ToString().Substring(1, 1999);
                        }
                        else
                        {
                            logInfo1.TemplateContent = sendMessageInfo.ToJSON().ToString();
                        }
                        logInfo1.VipId        = VipId;
                        logInfo1.WeiXinUserId = OpenId;
                        logInfo1.CreateTime   = System.DateTime.Now;
                        logServer.Create(logInfo1);
                        #endregion
                    }

                    var ResultEntity = server.SendMessage(sendMessageInfo, wxInfo.AppID, wxInfo.AppSecret, this.CurrentUserInfo, true);


                    #region Jermyn20140110 处理复星年会的座位信息,是临时的
                    //FStaffBLL staffServer = new FStaffBLL(this.CurrentUserInfo);
                    //bool bReturn = staffServer.SetStaffSeatsPush(VipId, eventInfo.EventID, out strError);
                    //MarketSendLogEntity logInfo2 = new MarketSendLogEntity();
                    //logInfo2.LogId = BaseService.NewGuidPub();
                    //logInfo2.IsSuccess = 1;
                    //logInfo2.MarketEventId = eventInfo.EventID;
                    //logInfo2.SendTypeId = "2";
                    //logInfo2.TemplateContent = strError;
                    //logInfo2.Phone = iRad.ToString();
                    //logInfo2.VipId = VipId;
                    //logInfo2.WeiXinUserId = OpenId;
                    //logInfo2.CreateTime = System.DateTime.Now;
                    //logServer.Create(logInfo2);

                    #endregion
                    strError = "ok";
                    return(true);
                }
            }
            catch (Exception ex) {
                strError = ex.ToString();
                return(false);
            }
        }
Beispiel #11
0
        /// <summary>
        /// 订单支付成功修改状态
        /// </summary>
        /// <param name="orderId">订单标识</param>
        /// <param name="strError">错误提示</param>
        /// <param name="ChannelId">支付渠道标识</param>
        /// <returns></returns>
        public bool SetOrderPayment(string orderId, out string strError, string ChannelId = null,
                                    string SerialPay = null)
        //public bool SetOrderPayment(string orderId, out string strError, string ChannelId = null)
        {
            MarketSendLogBLL    logSerer = new MarketSendLogBLL(this.CurrentUserInfo);
            MarketSendLogEntity logInfo  = new MarketSendLogEntity();

            logInfo.LogId         = BaseService.NewGuidPub();
            logInfo.VipId         = "System";
            logInfo.MarketEventId = orderId;
            logInfo.Phone         = ChannelId;
            logInfo.SendTypeId    = "3";
            try
            {
                bool bReturn = this._currentDAO.SetOrderPayment(orderId, out strError, ChannelId);
                if (bReturn)
                {
                    //算积分
                    //var bll = new JIT.CPOS.BS.BLL.InoutService(this.CurrentUserInfo);
                    //var orderInfo = bll.GetInoutInfoById(orderId);
                    //VipIntegralBLL vipIntegralServer = new VipIntegralBLL(this.CurrentUserInfo);

                    //Loggers.Debug(new DebugLogInfo()
                    //{
                    //    Message = string.Format("SetOrderPayment-参数: sourceId={0},customerId={1},vipId={2},orderId={3}", 1, this.CurrentUserInfo.CurrentUser.customer_id, orderInfo.vip_no, orderId)
                    //});
                    //vipIntegralServer.ProcessPoint(1, this.CurrentUserInfo.CurrentUser.customer_id, orderInfo.vip_no, orderId);

                    this._currentDAO.OrderPayCallBack(orderId, SerialPay, this.CurrentUserInfo.ClientID,
                                                      Convert.ToInt32(ChannelId));

                    strError = "成功.";
                    logInfo.TemplateContent = strError;
                    logSerer.Create(logInfo);



                    //记录日志  qianzhi 2014-03-17
                    //var inoutStatus = new TInoutStatusBLL(CurrentUserInfo);
                    //TInoutStatusEntity info = new TInoutStatusEntity();
                    //info.InoutStatusID = Guid.Parse(Utils.NewGuid());
                    //info.OrderID = orderId;
                    //info.CustomerID = CurrentUserInfo.CurrentLoggingManager.Customer_Id;
                    //info.OrderStatus = 10000; //支付方式
                    //info.Remark = "支付成功";
                    //info.StatusRemark = "订单支付成功[操作人:" + CurrentUserInfo.CurrentUser.User_Name + "]";
                    //inoutStatus.Create(info);

                    T_InoutBLL inoutBLL = new T_InoutBLL(this.CurrentUserInfo);
                    inoutBLL.SetVirtualItem(CurrentUserInfo, orderId); //支付回调/收款处理虚拟商品订单

                    return(true);
                }
                return(bReturn);
            }
            catch (Exception ex)
            {
                strError = ex.ToString();
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("SetOrderPayment-失败: {0}", strError)
                });
                logInfo.TemplateContent = strError.Substring(0, 100);
                logInfo.IsSuccess       = 0;
                logSerer.Create(logInfo);
                return(false);
            }
        }