Exemplo n.º 1
0
        public DataList <SellSerial> GetSerial(string cashbagCode, int startIndex, int count)
        {
            var bm    = businessmanRepository.FindAll(p => p.CashbagCode == cashbagCode).FirstOrDefault();
            var Slist = new DataList <SellSerial>();

            if (bm != null)
            {
                var query = orderRepository.FindAll(p =>
                                                    p.BusinessmanCode == bm.Code &&
                                                    p.OrderStatus == EnumOrderStatus.IssueAndCompleted &&
                                                    p.IssueTicketTime > DateTime.Now.AddMonths(-3) &&
                                                    p.IssueTicketTime <= DateTime.Now
                                                    );

                Slist.TotalCount = query.Count();
                Slist.List       = query.OrderBy(p => p.IssueTicketTime).Skip(startIndex).Take(count).Select(p => new SellSerial()
                {
                    OrderId  = p.OrderId,
                    Money    = p.OrderMoney,
                    SellTime = (DateTime)p.IssueTicketTime,
                    Remark   = p.Remark
                }).ToList();
            }
            return(Slist);
        }
Exemplo n.º 2
0
        //根据运营商Code获取运营商信息
        private Carrier GetCarrierInfo(string carrierCode)
        {
            Carrier carrierInfo = null;

            carrierInfo = _businessmanRepository.FindAll(q => q.Code == carrierCode).OfType <Carrier>().FirstOrDefault();
            if (carrierInfo == null)
            {
                throw new CustomException(_errorCode, "运营商编号" + carrierCode + "不存在。");
            }
            return(carrierInfo);
        }
Exemplo n.º 3
0
        public void InnerTransfer(string targetcode, string money, string pwd, string notes)
        {
            var bm = businessmanRepository.FindAll(p => p.Code == targetcode).FirstOrDefault();

            if (bm != null)
            {
                fundClientProxy.InnerTransfer(code, key, bm.CashbagCode, money, pwd, notes);
            }
            else
            {
                fundClientProxy.InnerTransfer(code, key, string.Empty, money, pwd, notes);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 发送给指定的运营商
 /// </summary>
 /// <param name="carrierCodes"></param>
 /// <param name="command"></param>
 /// <param name="content"></param>
 /// <param name="isRepeatSend"></param>
 /// <param name="param"></param>
 public static void SendByCarrier(string[] carrierCodes, EnumPushCommands command, string content, bool isRepeatSend = false, params object[] param)
 {
     IBusinessmanRepository _repository = StructureMap.ObjectFactory.GetInstance<IBusinessmanRepository>();
     //获取发送商户
     var sendArray = _repository.FindAll().OfType<Buyer>().Where(p => carrierCodes.Contains(p.CarrierCode)).Select(p => p.Code).ToArray();
     SendMsgByBuyerCodes(sendArray, command, content, isRepeatSend, param);
 }
Exemplo n.º 5
0
        public void Process(HttpRequest request, HttpResponse response)
        {
            Logger.WriteLog(LogType.INFO, request.Url.ToString());
            string orderid  = request.QueryString["orderId"];
            string outPayNo = request.QueryString["payNo"];
            string remark   = request.QueryString["remark"];
            string payway   = request.QueryString["payWay"];
            var    model    = businessmanRepository.FindAll(x => x.Code == remark).FirstOrDefault();

            if (model == null)
            {
                return;
            }
            var buyModel = model.BuyDetails.Where(p => p.PayNo == orderid).FirstOrDefault();

            if (buyModel != null && string.IsNullOrEmpty(buyModel.OutPayNo))
            {
                model.SMSNotify(orderid, outPayNo, ExtHelper.GetPayMethod(payway));
                unitOfWorkRepository.PersistUpdateOf(model);
                unitOfWork.Commit();
            }
            response.WriteLine("success");

            if (string.Equals(remark, "BankOrPlatform", StringComparison.OrdinalIgnoreCase))
            {
            }
        }
        public void SetBuyerToGroup(IList <string> buyerCodes, string groupID)
        {
            #region 数据验证

            if (string.IsNullOrWhiteSpace(groupID))
            {
                throw new CustomException(_errorCode, "分组ID不可为空。");
            }
            if (_stationBuyGroupRepository.FindAll(q => q.ID == groupID).Count() == 0)
            {
                throw new CustomException(_errorCode, "分组ID不存在。");
            }

            #endregion

            if (buyerCodes != null)
            {
                foreach (string code in buyerCodes)
                {
                    var buyer = _businessmanRepository.FindAll().Cast <Buyer>().Where(q => q.Code == code).FirstOrDefault();

                    if (buyer == null)
                    {
                        throw new CustomException(_errorCode, "商户号" + code + "不存在。");
                    }
                    buyer.StationBuyGroupID = groupID;

                    _businessmanRepository.Update(buyer);
                }
            }

            _unitOfWork.Commit();
        }
Exemplo n.º 7
0
 /// <summary>
 /// 发送所有客户端[Buyer]
 /// </summary>
 public static void SendAll(EnumPushCommands command, string content, bool isRepeatSend = false, params object[] param)
 {
     IBusinessmanRepository _repository = StructureMap.ObjectFactory.GetInstance<IBusinessmanRepository>();
     //获取所有商户信息
     var sendArray = _repository.FindAll().OfType<Buyer>().Select(p => p.Code).ToArray();
     foreach (var item in sendArray)
     {
         Send(item, command, content, isRepeatSend, param);
     }
 }
Exemplo n.º 8
0
        public static void SaveBehaviorStat(string code, EnumBehaviorOperate enumBeOperate)
        {
            try
            {
                var model = businessmanRepository.FindAll(p => p.Code == code).FirstOrDefault();
                if (model == null)
                {
                    return;
                }
                var businessName = string.Empty;
                var type         = string.Empty;
                var carrierCode  = string.Empty;
                var contactName  = string.Empty;//业务员
                var operatorName = string.Empty;
                if (model is Carrier)
                {
                    carrierCode = code;
                    type        = "Carrier";
                }
                else if (model is Buyer)
                {
                    carrierCode = (model as Buyer).CarrierCode;
                    type        = "Buyer";
                }
                else if (model is Supplier)
                {
                    type = "Supplier";
                }
                businessName = model.Name;
                contactName  = model.ContactName;
                operatorName = model.Operators != null?model.Operators.FirstOrDefault().Realname : "";

                SaveBehaviorStat(code, businessName, type, carrierCode, contactName, operatorName, enumBeOperate);
            }
            catch (Exception e)
            {
                Logger.WriteLog(LogType.ERROR, "保存用户操作行为异常[" + enumBeOperate + "]", e);
            }
        }
Exemplo n.º 9
0
        public List <OperatorDto> GetAllOperators(string realName, string account, EnumOperatorState?operatorState)
        {
            string code        = AuthManager.GetCurrentUser().Code;
            var    businessman = businessmanRepository.FindAll(x => x.Code == code).SingleOrDefault();

            var query = businessman.GetOperatorsBySearch(realName, account, operatorState);

            return(query.ToList().Select(p => new OperatorDto
            {
                Account = p.Account,
                OperatorState = p.OperatorState,
                Phone = p.Phone,
                Realname = p.Realname,
                CreateDate = p.CreateDate,
                Id = p.Id,
                Tel = p.Tel
            }).ToList());
        }
Exemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="user"></param>
        /// <param name="action"></param>
        /// <param name="loginIp"></param>
        /// <param name="businessmanType">0:采购,1,后台</param>
        /// <returns></returns>
        public UserAuthResult <CurrentUserInfo> Login(LoginParames user, System.Action <string> action)
        {
            var bussinessMan = businessmanRepository.FindAll(p => p.Code.ToUpper() == user.Code.ToUpper()).FirstOrDefault();

            if (bussinessMan == null)
            {
                throw new AuthException("没有找到商户号为" + user.Code + "的商户信息");
            }
            if (user.BusinessmanType == 0 && (bussinessMan is Supplier || bussinessMan is Carrier))
            {
                throw new AuthException("没有找到商户号为" + user.Code + "的商户信息。");
            }
            if (user.BusinessmanType == 1 && bussinessMan is Buyer)
            {
                throw new AuthException("没有找到商户号为" + user.Code + "的商户信息!");
            }
            if (!bussinessMan.IsEnable)
            {
                throw new AuthException("此商户号已经被冻结,请联系管理员");
            }
            var oper = bussinessMan.GetOperatorByPasswordAndAccount(user.Account.Trim(), user.Password);

            if (oper == null)
            {
                throw new AuthException("用户名或密码错误");
            }
            if (oper.OperatorState == Common.Enums.EnumOperatorState.Frozen)
            {
                throw new AuthException("该用户账号已被冻结");
            }
            if (user.BusinessmanType == 1 && oper.IsAdmin == false && oper.Role == null)
            {
                throw new AuthException("该帐号没有权限登录,请联系管理员!");
            }
            var currentUserInfo = new CurrentUserInfo()
            {
                Type            = bussinessMan.GetType().BaseType.Name,
                OperatorAccount = oper.Account,
                Code            = bussinessMan.Code,
                BusinessmanName = bussinessMan.Name,
                CashbagCode     = bussinessMan.CashbagCode,
                CashbagKey      = bussinessMan.CashbagKey,
                OperatorName    = oper.Realname,
                OperatorPhone   = oper.Phone,
                IsAdmin         = oper.IsAdmin,
                SettingInfo     = new SystemSettingInfo()
                {
                    SmsPrice = SettingSection.GetInstances().Sms.SmsPrice
                }
            };

            if (bussinessMan is Supplier)
            {
                currentUserInfo.CarrierCode = (bussinessMan as Supplier).CarrierCode;
            }
            if (bussinessMan is Buyer)
            {
                currentUserInfo.ContactName = (bussinessMan as Buyer).ContactName;
                currentUserInfo.Phone       = (bussinessMan as Buyer).Phone;
                currentUserInfo.CarrierCode = (bussinessMan as Buyer).CarrierCode;
            }
            if (bussinessMan is Carrier)
            {
                currentUserInfo.ContactName = oper.Realname;
            }
            LoginLog loginLog = new LoginLog
            {
                Code      = bussinessMan.Code,
                Account   = oper.Account,
                LoginIP   = user.LoginIP,
                LoginDate = System.DateTime.Now
            };
            var ur = new UserAuthResult <CurrentUserInfo>(currentUserInfo);

            ur.Save(p =>
            {
                action(currentUserInfo.GetIdentity());
            });
            //引发领域事件
            DomainEvents.Raise(new UserLoginEvent()
            {
                User = ur.UserInfo, LoginLog = loginLog
            });

            return(ur);
        }