コード例 #1
0
 /// <summary>
 /// 获取待结算盟豆
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <param name="LogType">Type of the log.</param>
 /// <returns>System.Decimal.</returns>
 public static decimal countTempBeansMoney(int userId, int LogType)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.countTempBeansMoney(userId, LogType));
     }
 }
コード例 #2
0
 /// <summary>
 /// 获取临时盟豆列表
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="lastId"></param>
 /// <returns></returns>
 public static List <TempBeansRecordsListModel> getTempBeansRecordsList(int userId, int lastId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(toTempBeansRecordsList(dal.getTempBeansRecordsList(userId, lastId, 0)));
     }
 }
コード例 #3
0
 /// <summary>
 /// 获取工作汇报
 /// </summary>
 /// <param name="shopId">The shop identifier.</param>
 /// <param name="model">The model.</param>
 /// <returns>ResultPageModel.</returns>
 public static ResultPageModel GetUserReportList(int shopId, SearchModel model)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetUserReportList(shopId, model));
     }
 }
コード例 #4
0
 /// <summary>
 /// 判断验证码是否有效
 /// </summary>
 /// <param name="mobile"></param>
 /// <param name="verifyCode"></param>
 /// <returns></returns>
 public static bool IsPassVerify(string mobile, string verifyCode)
 {
     using (var dal = FactoryDispatcher.SmsFactory())
     {
         return(dal.IsPassVerify(verifyCode, mobile));
     }
 }
コード例 #5
0
 public static int AddBeansRecords(BeansRecordsModel model)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.AddBeansRecords(model));
     }
 }
コード例 #6
0
 /// <summary>
 /// 设置验证码失效
 /// </summary>
 /// <param name="mobile"></param>
 /// <param name="verifyCode"></param>
 /// <returns></returns>
 public static bool UpdateVerifyCodeInvalid(string mobile, string verifyCode)
 {
     using (var dal = FactoryDispatcher.SmsFactory())
     {
         return(dal.UpdateVerifyCodeInvalid(verifyCode, mobile));
     }
 }
コード例 #7
0
 /// <summary>
 /// 删除工作汇报
 /// </summary>
 /// <param name="ID">The identifier.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public static bool DeleteUserReport(int ID)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.DeleteUserReport(ID));
     }
 }
コード例 #8
0
 /// <summary>
 /// 获取工作汇报实体
 /// </summary>
 /// <param name="workid">The workid.</param>
 /// <returns>UserReportModel.</returns>
 public static UserReportModel GetUserReportModel(int workid)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetUserReportModel(workid));
     }
 }
コード例 #9
0
 /// <summary>
 ///获取用户等级名称
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>System.String.</returns>
 public static string GetUserLevelName(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetUserLevelName(userId));
     }
 }
コード例 #10
0
 /// <summary>
 /// 获取用户工作汇报列表
 /// </summary>
 /// <param name="UserId">The user identifier.</param>
 /// <param name="pageIndex">Index of the page.</param>
 /// <param name="pageSize">Size of the page.</param>
 /// <returns>ResultPageModel.</returns>
 public static ResultPageModel GetAppUserReportList(int UserId, int pageIndex, int pageSize)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetAppUserReportList(UserId, pageIndex, pageSize));
     }
 }
コード例 #11
0
 /// <summary>
 /// 添加用户工作汇报
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>System.Int32.</returns>
 public static int AddAppUserReport(UserReportModel model)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.AddAppUserReport(model));
     }
 }
コード例 #12
0
 /// <summary>
 /// 添加用户订单成交量
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public static bool AddUserOrderSuccessAmount(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.AddUserOrderSuccessAmount(userId));
     }
 }
コード例 #13
0
 /// <summary>
 /// 获取排名
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>MyAllyIndexModel.</returns>
 public static MyAllyIndexModel GetUserRank(int userId, int belongOne)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetUserRank(userId, belongOne));
     }
 }
コード例 #14
0
 /// <summary>
 ///添加用户客户提交量
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public static bool AddUserCustomerAmount(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.AddUserCustomerAmount(userId));
     }
 }
コード例 #15
0
 /// <summary>
 /// 删除用户
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public static bool DeleteUser(int userId)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.DeleltUserInfo(userId));
     }
 }
コード例 #16
0
 /// <summary>
 /// 获取盟友申请列表
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>ResultPageModel.</returns>
 public static ResultPageModel GetApplyFriendList(SearchModel model)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         return(dal.GetApplyFriendList(model));
     }
 }
コード例 #17
0
        /// <summary>
        ///   盟友申请审核
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="id"></param>
        /// <param name="status">1成功2拒绝</param>
        /// <returns></returns>
        public static bool AllyApplyAudit(int userId, int id, int status, ref ApiStatusCode code)
        {
            using (var dal = FactoryDispatcher.UserFactory())
            {
                ApplyFriendModel model = dal.getApplyFriendModel(id);
                if (model == null || model.UserId != userId)
                {
                    code = ApiStatusCode.操作失败;
                    return(false);
                }

                if (status == 1)
                {
                    //using (TransactionScope scope = new TransactionScope())
                    //{
                    dal.updateApplyFriendStatus(id, 1);
                    UserRegisterModel register = new UserRegisterModel();
                    register.belongOne     = userId;
                    register.loginName     = model.Mobile;
                    register.loginPassword = model.Password;
                    register.mobile        = model.Mobile;
                    register.nickname      = model.NickName;
                    register.ShopId        = dal.getUserShopId(userId);
                    register.BelongShopId  = ShopLogic.GetBelongShopId(register.ShopId);
                    register.storeId       = ConstConfig.storeId;
                    register.UserIdentity  = 0;
                    register.username      = model.UserName;
                    register.userGender    = model.Sex == 1 ? "M" : "F";
                    if (dal.AddUserInfo(register) > 0)
                    {
                        masterUpdate(userId);

                        //获取积分奖励配置
                        ScoreConfigModel scoreCfg = ConfigLogic.GetScoreConfig();
                        //添加盟主创建订单,奖励积分
                        if (scoreCfg.CreateOrderScore > 0 && dal.addUserIntegral(userId, scoreCfg.CreateOrderScore) > 0)
                        {
                            BeansRecordsModel model2 = new BeansRecordsModel();
                            model2.Amount     = scoreCfg.CreateOrderScore;
                            model2.UserId     = userId;
                            model2.LogType    = 1;
                            model2.Income     = 1;
                            model2.Remark     = "邀请盟友奖励";
                            model2.OrderId    = "";
                            model2.CreateTime = DateTime.Now;
                            dal.AddBeansRecords(model2);
                        }
                    }
                    //    scope.Complete();
                    //}
                }
                else if (status == 2)
                {
                    dal.updateApplyFriendStatus(id, 2);
                }
            }
            return(true);
        }
コード例 #18
0
ファイル: OrderLogic.cs プロジェクト: huangliliu0917/BMeng
 /// <summary>
 /// 更新上传凭证信息
 /// </summary>
 /// <param name="orderId">The order identifier.</param>
 /// <param name="customer">The customer.</param>
 /// <param name="mobile">The mobile.</param>
 /// <param name="price">The price.</param>
 /// <param name="memo">The memo.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <returns>System.Int32.</returns>
 public static int UploadVoucher(string orderId, string customer
                                 , string mobile, decimal price, string memo, string fileName, string fileName2, string fileName3, string fileName4, string fileName5)
 {
     using (var dal = FactoryDispatcher.OrderFactory())
     {
         return(dal.UploadVoucher(orderId, customer
                                  , mobile, price, memo, fileName, fileName2, fileName3, fileName4, fileName5));
     }
 }
コード例 #19
0
 /// <summary>
 /// 修改密码
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <param name="oldPassword">The old password.</param>
 /// <param name="password">The password.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public static bool ChanagePassword(int userId, string oldPassword, string password)
 {
     using (var dal = FactoryDispatcher.UserFactory())
     {
         bool flag = dal.ChanagePassword(userId, oldPassword, password);
         if (flag)
         {
             string token = EncryptHelper.MD5(StringHelper.CreateCheckCode(20));
             dal.UpdateUserAuthToken(userId, token);
         }
         return(flag);
     }
 }
コード例 #20
0
ファイル: FocusPicLogic.cs プロジェクト: guomw/bameng
 /// <summary>
 /// 编辑焦点广告图
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns></returns>
 public static bool EditFocusPic(FocusPicModel model)
 {
     using (var dal = FactoryDispatcher.FocusFactory())
     {
         if (model.ID > 0)
         {
             return(dal.UpdateFocusPic(model));
         }
         else
         {
             return(dal.AddFocusPic(model) > 0);
         }
     }
 }
コード例 #21
0
        /// <summary>
        /// 更新配置信息
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>true if XXXX, false otherwise.</returns>
        public static bool UpdateValue(ConfigModel model)
        {
            using (var dal = FactoryDispatcher.ConfigFactory())
            {
                bool flag = dal.UpdateValue(model);

                if (flag)
                {
                    WebCacheHelper.DeleteDepFile(cacheKey);
                }

                return(flag);
            }
        }
コード例 #22
0
        /// <summary>
        /// 获取配置数据
        /// </summary>
        /// <returns>List&lt;ConfigModel&gt;.</returns>
        public static List <ConfigModel> GetConfigList()
        {
            List <ConfigModel> lst = WebCacheHelper <List <ConfigModel> > .Get(cacheKey);

            if (lst == null)
            {
                using (var dal = FactoryDispatcher.ConfigFactory())
                {
                    lst = dal.List();
                    WebCacheHelper.Insert(cacheKey, lst, new System.Web.Caching.CacheDependency(WebCacheHelper.GetDepFile(cacheKey)));
                }
            }
            return(lst);
        }
コード例 #23
0
 /// <summary>
 /// 编辑资讯信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static bool EditArticle(ArticleModel model)
 {
     using (var dal = FactoryDispatcher.ArticleFactory())
     {
         if (model.ArticleId > 0)
         {
             return(dal.UpdateArticle(model));
         }
         else
         {
             return(dal.AddArticle(model) > 0);
         }
     }
 }
コード例 #24
0
ファイル: LogLogic.cs プロジェクト: huangliliu0917/BMeng
        public static StatisticsPieModel OrderStatisticsPie(AdminLoginModel user, string startTime, string endTime)
        {
            StatisticsPieModel data1 = new StatisticsPieModel();


            using (var dal = FactoryDispatcher.LogFactory())
            {
                List <StatisticsListModel> lst = null;
                if (user.UserIndentity == 0)
                {
                    lst = dal.OrderStatisticsPieByAdmin(startTime, endTime);
                }
                else if (user.UserIndentity == 1)
                {
                    lst = dal.OrderStatisticsPieByBelongShop(user.ID, startTime, endTime);
                }
                else if (user.UserIndentity == 2)
                {
                    lst = dal.OrderStatisticsPieByShop(user.ID, startTime, endTime);
                }

                if (lst != null && lst.Count() > 0)
                {
                    foreach (var item in lst)
                    {
                        data1.xData.Add(item.xData);
                        PieCountModel pie = new PieCountModel();
                        pie.name  = item.xData;
                        pie.value = item.yData;
                        data1.yData.Add(pie);
                        data1.total += item.yData;
                    }
                }


                if (data1.xData.Count() == 0)
                {
                    string dtime = DateTime.Now.ToString("yyyy-MM-dd");
                    data1.xData.Add(dtime);
                    PieCountModel pie = new PieCountModel();
                    pie.name  = "";
                    pie.value = 0;
                    data1.yData.Add(pie);
                }

                return(data1);
            }
        }
コード例 #25
0
ファイル: LogLogic.cs プロジェクト: huangliliu0917/BMeng
        /// <summary>
        /// 登录统计
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="startTime">The start time.</param>
        /// <param name="endTime">The end time.</param>
        public static StatisticsModel LoginStatistics(AdminLoginModel user, int type, string startTime, string endTime)
        {
            using (var dal = FactoryDispatcher.LogFactory())
            {
                StatisticsModel            data = new StatisticsModel();
                List <StatisticsListModel> lst  = null;
                //string cacheKey = string.Format("BMLOGIN{0}{1}{2}", user.UserIndentity, type, DateTime.Now.ToString("yyyyMMdd"));
                //if (type != 0)
                //{
                //    lst = WebCacheHelper<List<StatisticsListModel>>.Get(cacheKey);
                //    if (lst == null)
                //    {
                //        lst = dal.LoginStatistics(user.ID, user.UserIndentity, startTime, endTime);
                //        WebCacheHelper.Insert(cacheKey, lst, new System.Web.Caching.CacheDependency(WebCacheHelper.GetDepFile(cacheKey)));
                //    }
                //}
                //else
                lst = dal.LoginStatistics(user.ID, user.UserIndentity, startTime, endTime);
                if (lst != null && lst.Count() > 0)
                {
                    int len = lst.Count();
                    if (len < 5)
                    {
                        string t = lst[0].xData;
                        data.xData.Add(Convert.ToDateTime(t).AddDays(-1).ToString("yyyy-MM-dd"));
                        data.yData.Add(0);
                    }
                    foreach (var item in lst)
                    {
                        data.xData.Add(item.xData);
                        data.yData.Add(item.yData);
                        data.total += item.yData;
                    }
                    //string t2 = lst[len - 1].xData;
                    //data.xData.Add(Convert.ToDateTime(t2).AddDays(1).ToString("yyyy-MM-dd"));
                    //data.yData.Add(0);
                }

                if (data.xData.Count() == 0)
                {
                    string dtime = DateTime.Now.ToString("yyyy-MM-dd");
                    data.xData.Add(dtime);
                    data.yData.Add(0);
                }

                return(data);
            }
        }
コード例 #26
0
 /// <summary>
 /// 更新配置信息
 /// </summary>
 /// <param name="lst">The LST.</param>
 /// <returns>true if XXXX, false otherwise.</returns>
 public static bool UpdateValue(List <ConfigModel> lst)
 {
     using (var dal = FactoryDispatcher.ConfigFactory())
     {
         foreach (var item in lst)
         {
             dal.UpdateValue(new ConfigModel()
             {
                 Code   = item.Code,
                 Value  = item.Value,
                 Remark = item.Remark
             });
         }
         return(true);
     }
 }
コード例 #27
0
ファイル: CouponLogic.cs プロジェクト: huangliliu0917/BMeng
        /// <summary>
        /// 添加优惠券发送记录
        /// </summary>
        /// <param name="userId">发送人ID</param>
        /// <param name="Int32">The int32.</param>
        /// <param name="userIdentity">用户身份,0盟友  1盟主.</param>
        /// <param name="sendToUserId">接收用户ID,如果是自己转发,则为0</param>
        /// <param name="couponId">优惠券ID</param>
        /// <returns>true if XXXX, false otherwise.</returns>
        public static bool AddSendCoupon(int userId, int userIdentity, int sendToUserId, int couponId)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                using (var dal = FactoryDispatcher.CouponFactory())
                {
                    bool flag = dal.AddSendCoupon(userId, sendToUserId, couponId);

                    //如果盟主自己分享或发送给盟友,则创建现金券记录
                    if (flag && userIdentity == 1)
                    {
                        CashCouponModel couponModel = dal.GetModel(couponId);
                        if (couponModel != null)
                        {
                            int BelongOneUserId = userId;

                            int belongOneShopId = ShopLogic.GetBelongShopId(couponModel.ShopId);
                            if (belongOneShopId == 0)
                            {
                                belongOneShopId = couponModel.ShopId;
                            }

                            dal.CreateUserCashCouponLog(new CashCouponLogModel()
                            {
                                CouponId        = couponId,
                                CouponNo        = couponModel.ShopId.ToString() + StringHelper.CreateCheckCodeWithNum(10).ToLower(),
                                UserId          = sendToUserId > 0 ? sendToUserId : userId,
                                IsShare         = sendToUserId > 0 ? 0 : 1,
                                Money           = couponModel.Money,
                                StartTime       = couponModel.StartTime,
                                EndTime         = couponModel.EndTime,
                                ShopId          = couponModel.ShopId,
                                BelongOneUserId = BelongOneUserId,
                                BelongOneShopId = belongOneShopId
                            });
                        }
                    }
                    if (flag && userIdentity == 0)
                    {
                        dal.UpdateCouponShareStatus(userId, couponId);
                    }

                    scope.Complete();
                    return(flag);
                }
            }
        }
コード例 #28
0
        /// <summary>
        /// 兑换审核
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="id"></param>
        /// <param name="status">1同意2拒绝</param>
        /// <returns></returns>
        public static bool ConvertAudit(int userId, int id, int status, ref ApiStatusCode code)
        {
            using (var dal = FactoryDispatcher.UserFactory())
            {
                BeansConvertModel model = dal.getBeansConvertModel(id);
                using (TransactionScope scope = new TransactionScope())
                {
                    if (model == null || model.Status != 0 || model.UserMasterId != userId)
                    {
                        code = ApiStatusCode.兑换审核存在异常;
                        return(false);
                    }

                    if (status == 1)
                    {
                        dal.addMengBeansLocked(model.UserId, -model.Amount);
                        dal.addUserMoney(model.UserId, -model.Amount);
                        dal.updateBeansConvertStatus(id, 1);



                        BeansRecordsModel model2 = new BeansRecordsModel();
                        model2.Amount     = -model.Amount;
                        model2.UserId     = model.UserId;
                        model2.LogType    = 0;
                        model2.Income     = 0;
                        model2.Remark     = "兑换";
                        model2.OrderId    = "";
                        model2.CreateTime = DateTime.Now;
                        dal.AddBeansRecords(model2);
                    }
                    else if (status == 2)
                    {
                        dal.addMengBeansLocked(model.UserId, -model.Amount);
                        dal.updateBeansConvertStatus(id, 2);
                    }

                    dal.updateBeansConvertStatus(id, status);

                    scope.Complete();
                }
            }
            return(true);
        }
コード例 #29
0
ファイル: CouponLogic.cs プロジェクト: huangliliu0917/BMeng
        /// <summary>
        ///给盟友发送优惠券
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <param name="couponId">The coupon identifier.</param>
        /// <param name="TargetIds">The target ids.</param>
        /// <returns>true if XXXX, false otherwise.</returns>
        public static bool AddSendAllyCoupon(int userId, int couponId, string[] TargetIds)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                using (var dal = FactoryDispatcher.CouponFactory())
                {
                    bool flag = dal.AddSendCoupon(userId, 0, couponId);

                    //如果盟主自己分享或发送给盟友,则创建现金券记录
                    CashCouponModel couponModel = dal.GetModel(couponId);
                    if (couponModel != null)
                    {
                        int    BelongOneUserId = userId;
                        string cpNo            = couponModel.ShopId.ToString() + StringHelper.CreateCheckCodeWithNum(10).ToLower();
                        foreach (var item in TargetIds)
                        {
                            int sendToUserId = Convert.ToInt32(item);

                            int belongOneShopId = ShopLogic.GetBelongShopId(couponModel.ShopId);
                            if (belongOneShopId == 0)
                            {
                                belongOneShopId = couponModel.ShopId;
                            }

                            dal.CreateUserCashCouponLog(new CashCouponLogModel()
                            {
                                CouponId        = couponId,
                                CouponNo        = cpNo,
                                UserId          = sendToUserId,
                                IsShare         = 0,
                                Money           = couponModel.Money,
                                StartTime       = couponModel.StartTime,
                                EndTime         = couponModel.EndTime,
                                ShopId          = couponModel.ShopId,
                                BelongOneUserId = BelongOneUserId,
                                BelongOneShopId = belongOneShopId
                            });
                        }
                    }
                    scope.Complete();
                    return(flag);
                }
            }
        }
コード例 #30
0
        /// 获取签到信息
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>MemberSignModel.</returns>
        public static MemberSignModel GetMemberSignModel(int userId)
        {
            using (var dal = FactoryDispatcher.UserFactory())
            {
                string          cacheKey = GetMemberSignCacheKey(userId);
                MemberSignModel model    = WebCacheHelper <MemberSignModel> .Get(cacheKey);

                if (model == null)
                {
                    model = dal.GetMemberSignModel(userId);
                    if (model == null)
                    {
                        return(null);
                    }
                    WebCacheHelper.Insert(cacheKey, model, new System.Web.Caching.CacheDependency(WebCacheHelper.GetDepFile(cacheKey)));
                }
                return(model);
            }
        }