Ejemplo n.º 1
0
        /// <summary>
        /// 修改备注
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public static OpResult SetMemo(int id, string memo)
        {
            var list = CurrentRepository.Find(o => o.Id == id);

            list.Memo = memo;
            return(Update(list));
        }
Ejemplo n.º 2
0
        public static MemberInfo GetMemberInfo(string storeId, int companyId, string phone, string uid, string cardNo)
        {
            var memberInfo = new MemberInfo();
            var member     = new Members();

            if (!string.IsNullOrEmpty(phone))
            {
                member = CurrentRepository.Find(o => o.MobilePhone == phone && o.CompanyId == companyId);
            }
            else if (!string.IsNullOrEmpty(cardNo))
            {
                var carno = MembershipCardService.CurrentRepository.Find(o => o.CardSN == cardNo);
                member = CurrentRepository.Find(o => o.CompanyId == companyId && o.MemberId == carno.MemberId);
            }

            if (member != null)
            {
                memberInfo.MemberId       = member.MemberId;
                memberInfo.MobilePhone    = member.MobilePhone;
                memberInfo.RealName       = member.RealName;
                memberInfo.MemberCardNum  = cardNo;
                memberInfo.UsableIntegral = member.UsableIntegral;
                return(memberInfo);
            }
            throw new Pos.Exceptions.PosException("未找到会员信息!");
        }
Ejemplo n.º 3
0
 public Tuple <bool, string> UseSessionCode(long id)
 {
     try
     {
         var result = CurrentRepository.Find(id);
         if (result != null)
         {
             if (result.type != 0 || result.create_datetime.AddDays(7) < DateTime.Now)
             {
                 return(new Tuple <bool, string>(false, "expired"));
             }
             else
             {
                 result.type = 1;
                 var success = CurrentRepository.Update(result);
                 return(new Tuple <bool, string>(success, string.Empty));
             }
         }
         else
         {
             return(new Tuple <bool, string>(false, "not existed"));
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 根据邮箱或手机号获得实体
 /// </summary>
 /// <param name="userName">手机号或邮箱</param>
 /// <returns></returns>
 public Member Find(string userName)
 {
     if (RegexUtil.IsMobilePhone(userName))
     {
         return(CurrentRepository.Find(member => member.Phone_mob == userName));
     }
     return(CurrentRepository.Find(member => member.Email == userName));
 }
Ejemplo n.º 5
0
 public IEnumerable <interact_post> LoadPostListByPage(int pageNo, int pageSize)
 {
     return
         (CurrentRepository.Find(it => it.state.HasValue && it.state.Value != 0).OrderByDescending(
              it =>
              it
              .release_time)
          .Skip(pageSize * Math.Max(0, pageNo - 1)).Take(pageSize));
 }
Ejemplo n.º 6
0
        T IEntityManager.Find <T>(object id)
        {
            dynamic retObj = Activator.CreateInstance <T>();

            retObj.Id = Guid.Parse(id.ToString());
            var result = CurrentRepository.Find <T>(GenerateSelectQueryId(retObj));

            return(result);
        }
        public static int GetPayCode(string title)
        {
            var entity = CurrentRepository.Find(o => o.Title == title);

            if (entity != null)
            {
                return(entity.ApiCode);
            }
            return(0);
        }
        public static string GetApiUrl(int apiCode)
        {
            var entity = CurrentRepository.Find(o => o.ApiCode == apiCode);

            if (entity != null)
            {
                return(entity.ApiUrl);
            }
            return("");
        }
        public static string GetUnitDict(int dicSN)
        {
            var dict = CurrentRepository.Find(o => o.DicSN == dicSN);

            if (dict != null)
            {
                return(dict.Title);
            }
            return("未知单位");
        }
Ejemplo n.º 10
0
        public bool CanUse(long id)
        {
            var entity = CurrentRepository.Find(id);

            if (entity != null && entity.type == 0 && entity.create_datetime.AddDays(7) > DateTime.Now)
            {
                return(true);
            }
            return(false);
        }
        public static string IsSaleMan(string userCode, string storeId)
        {
            string operateAuth = string.Format("{0},{1}", storeId, 2);
            var    result      = CurrentRepository.Find(o => o.UserCode == userCode && o.OperateAuth.Contains(operateAuth));

            if (result != null)
            {
                return(result.UID);
            }
            return(string.Empty);
        }
Ejemplo n.º 12
0
        public bool HasExpired(DateTime create, string key, string confirmCode)
        {
            var item = CurrentRepository.Find(
                it => it.create_datetime == create && it.session_key == key && it.verify_code == confirmCode)
                       .FirstOrDefault();

            if (item != null)
            {
                return(item.create_datetime.AddDays(7) < DateTime.Now);
            }
            return(true);
        }
Ejemplo n.º 13
0
        public static List <int> FindAllParent(int sn, int deep = -1)
        {
            var list   = new List <int>();
            var result = CurrentRepository.Find(o => o.CategorySN == sn && (o.Grade == deep || deep == -1));

            if (result != null)
            {
                if (deep == -1)
                {
                    deep = result.Grade;
                }
                list.Add(result.CategoryPSN);
                if (result.CategoryPSN != 0 && deep > 1)
                {
                    list = list.Concat(FindAllParent(result.CategoryPSN, --deep)).ToList();
                }
            }
            return(list);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 根据id获得实体
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Member Find(int id)
 {
     return(CurrentRepository.Find(m => m.User_id == id));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// 获得实体
 /// </summary>
 /// <param name="id">userid</param>
 /// <param name="pwd">加密后的密码</param>
 /// <returns></returns>
 public Member Find(int id, string pwd)
 {
     return(CurrentRepository.Find(m => m.User_id == id && m.Password == pwd));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 查询数据
 /// </summary>
 /// <param name="id">图片id</param>
 /// <returns>实体</returns>
 public Img Find(int id)
 {
     return(CurrentRepository.Find(s => s.Id == id));
 }
        public static int GetSalesClassifyId(string title)
        {
            var dict = CurrentRepository.Find(o => o.Title == title);

            return(dict == null ? -1 : dict.DicSN);
        }
Ejemplo n.º 18
0
 /// <summary>
 /// 根据classUsName获得实体
 /// </summary>
 /// <param name="classUsName"></param>
 /// <returns></returns>
 public ExchangeClass Find(string classUsName)
 {
     return(CurrentRepository.Find(e => e.ClassUsName == classUsName));
 }
Ejemplo n.º 19
0
 public Admin Find(string loginName)
 {
     return(CurrentRepository.Find(u => u.LoginName == loginName));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 通过Id查找命令记录
 /// </summary>
 /// <param name="commandId"></param>
 /// <returns></returns>
 public TB_Command Find(int commandId)
 {
     return(CurrentRepository.Find(c => c.id == commandId));
 }
Ejemplo n.º 21
0
 public Img Find(string md5)
 {
     return(CurrentRepository.Find(s => s.Md5 == md5));
 }
Ejemplo n.º 22
0
        public static MemberInfo GetMemberInfo(string storeId, int companyId, string phone, string uid, string cardNo)
        {
            var     memberInfo = new MemberInfo();
            Members member     = null;

            if (!string.IsNullOrEmpty(phone))
            {
                member = CurrentRepository.Find(o => o.MobilePhone == phone && o.CompanyId == companyId);
                if (member != null)
                {
                    cardNo = "";
                }
            }
            if (member == null && !string.IsNullOrEmpty(cardNo))
            {
                var carno = Pharos.Logic.ApiData.Pos.Services.ServerServices.MembershipCardService.CurrentRepository.Find(o => o.CardSN == cardNo && o.CompanyId == companyId);
                if (carno == null)
                {
                    goto NOTFOUND;
                }
                memberInfo.UsableAmount = carno.Balance;
                cardNo = carno.CardSN;
                member = CurrentRepository.Find(o => o.CompanyId == companyId && o.MemberId == carno.MemberId);
            }
            if (member == null && !string.IsNullOrEmpty(uid))
            {
                member = CurrentRepository.Find(o => o.CompanyId == companyId && o.MemberId == uid);
            }
            if (member != null)
            {
                var cards = Pharos.Logic.ApiData.Pos.Services.ServerServices.MembershipCardService.CurrentRepository.FindList(o => o.MemberId == member.MemberId && o.CompanyId == companyId).ToList();
                if (cards != null && cards.Count() > 0)
                {
                    memberInfo.MemberCards = cards.OrderByDescending(o => o.LeadTime).ThenByDescending(o => o.CreateDT).Select(o => new MemberCard()
                    {
                        CardNo = o.CardSN,
                        Amount = o.Balance,
                        State  = GetState(o.State)
                    }).ToList();
                    if (string.IsNullOrEmpty(cardNo))
                    {
                        var card = cards.FirstOrDefault(o => o.State == 1);
                        cardNo = card.CardSN;
                        memberInfo.UsableAmount = card.Balance;
                    }
                }
            }
            memberInfo.Sex = -1;
            if (member != null)
            {
                memberInfo.MemberId       = member.MemberNo;
                memberInfo.RecordId       = member.MemberId;
                memberInfo.Type           = member.Insider ? ObjectModels.DTOs.CustomerType.Insider : ObjectModels.DTOs.CustomerType.VIP;
                memberInfo.MobilePhone    = member.MobilePhone;
                memberInfo.RealName       = member.RealName;
                memberInfo.UsableIntegral = member.UsableIntegral;
                memberInfo.Birthday       = member.Birthday;
                memberInfo.Email          = member.Email;
                memberInfo.Sex            = member.Sex;
                memberInfo.WeiXin         = member.Weixin;
                memberInfo.ZhiFuBao       = member.Zhifubao;
                var province = AreaService.CurrentRepository.Entities.FirstOrDefault(o => o.AreaID == member.CurrentProvinceId);
                var city     = AreaService.CurrentRepository.Entities.FirstOrDefault(o => o.AreaID == member.CurrentCityId);
                var county   = AreaService.CurrentRepository.Entities.FirstOrDefault(o => o.AreaID == member.CurrentCountyId);

                memberInfo.Address = "";
                if (province != null && !string.IsNullOrEmpty(province.Title))
                {
                    memberInfo.Address += province.Title;
                }
                if (city != null && !string.IsNullOrEmpty(city.Title))
                {
                    memberInfo.Address += city.Title;
                }
                if (county != null && !string.IsNullOrEmpty(county.Title))
                {
                    memberInfo.Address += county.Title;
                }
                memberInfo.Address += member.Address;
            }
            memberInfo.MemberCardNum = cardNo;

            return(memberInfo);

NOTFOUND:
            throw new Pos.Exceptions.PosException("未找到会员信息!");
        }
Ejemplo n.º 23
0
 public User Find(int userID)
 {
     return(CurrentRepository.Find(u => u.UserID == userID));
 }
Ejemplo n.º 24
0
        public static BillHistoryInfo GetBillDetailsHistory(string storeId, string machineSn, string paySn, int companyId, bool inTestMode)
        {
            var order = CurrentRepository.Find(o => o.CustomOrderSn == paySn && o.StoreId == storeId && o.CompanyId == companyId && o.IsTest == inTestMode);

            if (order == null)
            {
                throw new PosException("未找到该订单!");
            }
            var isRefundOrder = CurrentRepository.IsExist(o => o.StoreId == storeId && o.CompanyId == companyId && o.ReFundOrderCustomOrderSn == paySn);
            var query         = (from a in SaleDetailService.CurrentRepository.Entities
                                 where a.PaySN == order.PaySN && a.CompanyId == companyId
                                 select a).ToList();
            List <BillDetails> bills = new List <BillDetails>();

            foreach (var item in query)
            {
                BillDetails bill;
                if (!string.IsNullOrEmpty(item.ProductCode))
                {
                    var b = ProductRecordService.CurrentRepository.Entities.FirstOrDefault(o => o.ProductCode == item.ProductCode && o.CompanyId == companyId);
                    bill = new BillDetails()
                    {
                        ActualPrice     = item.ActualPrice,
                        Barcode         = item.ScanBarcode,
                        Number          = item.PurchaseNumber,
                        Size            = b.Size,
                        Title           = b.Title,
                        SysPrice        = b.SysPrice,
                        Total           = item.Total,
                        Unit            = b.Unit,
                        ProductCode     = b.ProductCode,
                        SalesClassifyId = item.SalesClassifyId//SalesClassifyId08-03新增 为增加客户端显示角标
                    };
                }
                else
                {
                    var b = BundlingService.CurrentRepository.Entities.FirstOrDefault(o => o.NewBarcode == item.Barcode && o.CompanyId == companyId);
                    bill = new BillDetails()
                    {
                        ActualPrice = item.ActualPrice,
                        Barcode     = item.ScanBarcode,
                        Number      = item.PurchaseNumber,
                        Brand       = "",
                        Size        = "",
                        Title       = b.Title,
                        SysPrice    = b.SysPrices,
                        Total       = item.Total,
                        Unit        = "件",
                        ProductCode = "捆绑商品无货号"
                    };
                }
                if (bill != null)
                {
                    bills.Add(bill);
                }
            }

            var Pays     = ConsumptionPaymentService.CurrentRepository.Entities.Where(o => o.PaySN == order.PaySN);
            var apicodes = order.ApiCode.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries).Select(o => Convert.ToInt32(o));
            var payments = BaseGeneralService <ApiLibrary, LocalCeDbContext> .CurrentRepository.Entities.Where(o => o.CompanyId == companyId && apicodes.Contains(o.ApiCode)).ToList();

            var title = string.Empty;

            switch (payments.Count)
            {
            case 0:
                title = "未知支付方式";
                break;

            case 1:
                title = payments.FirstOrDefault().Title;
                break;

            default:
                title = "多方付";
                break;
            }
            var cashier = SysStoreUserInfoService.Find(o => o.UID == order.CreateUID && o.CompanyId == companyId);
            var saleman = SysStoreUserInfoService.Find(o => o.UID == order.Salesman && o.CompanyId == companyId);
            //查询抹零信息
            var wipeZero = WipeZeroService.Find(o => o.PaySN == paySn && o.CompanyId == companyId);

            var received = 0m;
            var change   = 0m;

            if (Pays.Count() > 0)
            {
                received = Pays.Sum(o => o.Received);
                change   = Pays.Sum(o => o.Change);
            }
            return(new BillHistoryInfo()
            {
                Details = bills,
                PreferentialAmount = order.PreferentialPrice,
                TotalAmount = order.TotalAmount,
                Payment = title,
                PaySn = order.CustomOrderSn,
                ProductCount = order.ProductCount,
                CashierId = cashier == null ? "未知" : cashier.UserCode,
                CashierName = cashier == null ? "未知" : cashier.FullName,
                Change = change,
                MachineSn = order.MachineSN,
                StoreId = order.StoreId,
                OrderTime = order.CreateDT,
                Received = received,
                OrderStatus = order.State,
                OrderType = order.Type,
                WipeZeroAfterTotalAmount = order.Receive,
                SaleManName = (saleman != null ? saleman.FullName : string.Empty),
                SaleManUserCode = (saleman != null ? saleman.UserCode : string.Empty),
                ReturnDT = order.ReturnDT,
                WipeZero = wipeZero == null ? 0m : wipeZero.Number,
                OrderDiscount = order.OrderDiscount,
                IsRefundOrder = isRefundOrder,
                OldOrderSN = order.ReFundOrderCustomOrderSn
            });
        }
Ejemplo n.º 25
0
 public bool Existed(Expression <Func <session_verify, bool> > whereLambda)
 {
     return(CurrentRepository.Find(whereLambda).Any());
 }
Ejemplo n.º 26
0
 /// <summary>
 /// 根据classId获得实体
 /// </summary>
 /// <param name="classId"></param>
 /// <returns></returns>
 public ExchangeClass Find(int classId)
 {
     return(CurrentRepository.Find(e => e.ClassId == classId));
 }
Ejemplo n.º 27
0
 /// <summary>
 /// 通过用户名和密码查询
 /// </summary>
 /// <param name="name"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public TB_Account Find(string name, string password)
 {
     return(CurrentRepository.Find(a => a.Code.Equals(name) && a.Password.Equals(password)));
 }
Ejemplo n.º 28
0
 public Admin Find(int Id)
 {
     return(CurrentRepository.Find(u => u.Id == Id));
 }
Ejemplo n.º 29
0
 public User Find(string userName)
 {
     return(CurrentRepository.Find(u => u.UserName == userName));
 }
Ejemplo n.º 30
0
 public T_User Find(int UserID)
 {
     return(CurrentRepository.Find(u => u.UserId == UserID));
 }