Example #1
0
        /// <summary>
        /// 存在返回id,不存在插入新记录并返回id
        /// </summary>
        /// <returns>The add.</returns>
        /// <param name="item">Item.</param>
        public Object Add(Passport passport, BillGoods item)
        {
            decimal taxRate = dal.GetTaxRate(item.BillId);

            item.InTotalPrice  = item.InUnitPrice * item.Quantity * (item.IsRMB ? 1 : taxRate);
            item.OutTotalPrice = item.OutUnitPrice * item.Quantity;
            item.Profit        = item.OutTotalPrice - item.InTotalPrice;
            //新商品,插入商品,再插入账单
            int result = 0;

            if (item.GoodsId == "")
            {
                item.Id      = TimeParser.GetTimeRandom();
                item.GoodsId = TimeParser.GetTimeRandom();
                result       = dal.AddBillGoodsAndGoods(passport.EnterpriseId, item);
            }
            else
            {
                item.Id = TimeParser.GetTimeRandom();
                result  = dal.AddBillGoods(item);
            }
            //计算
            ProfitDal profitDal = new ProfitDal();

            if (result > 0)
            {
                return(CustomerDataConverter.RowToProfit(profitDal.UpdateBillGoods(item.BillId, item.BillCustomerId, item.Id)));
            }
            else
            {
                return(ErrorMsg.AddFailMsg());
            }
        }
Example #2
0
        public User Login(User user)
        {
            user.Password = DESEncrypt.Encrypt(user.Password);
            List <User> result = CustomerDataConverter.RowToUserList(dal.Login(user));

            return(result.Count == 0 ? null : result[0]);
        }
Example #3
0
        public Address Find(Passport passport, string key)
        {
            MySqlDataReader dr   = dal.GetAddress(key);
            List <Address>  list = CustomerDataConverter.RowToAddressList(dr);

            return(list.Count > 0 ? list[0] : null);
        }
Example #4
0
        public object RemoveAndReturnProfit(Passport passport, DeleteBillGoods item)
        {
            ProfitDal profitDal = new ProfitDal();

            if (dal.DeleteBillGoods(item.BillGoodsId) > 0)
            {
                return(CustomerDataConverter.RowToProfit(profitDal.DeleteBillGoods(item.BillId, item.BillCustomerId)));
            }
            else
            {
                return(ErrorMsg.DeleteFailMsg());
            }
        }
Example #5
0
 public List <Goods> GetList(Passport passport, string key)
 {
     return(CustomerDataConverter.RowToGoodsList(dal.GetGoodsList(passport, key)));
 }
Example #6
0
 public List <Goods> GetAll(Passport passport)
 {
     return(CustomerDataConverter.RowToGoodsList(dal.GetGoodsAll(passport)));
 }
Example #7
0
 public List <BillCustomer> GetListByDocNo(Passport passport, string id)
 {
     return(CustomerDataConverter.RowToBillCustomerList(dal.GetBillCustomerList(id)));
 }
Example #8
0
        public List <Address> GetList(Passport passport, string customerId)
        {
            MySqlDataReader dr = dal.GetAddressListByCustomer(customerId);

            return(CustomerDataConverter.RowToAddressList(dr));
        }
Example #9
0
        public List <Address> FindByKeyWithUnBind(Passport passport, string key)
        {
            MySqlDataReader dr = dal.GetAddressListByKeyWithUnBind(passport, key);

            return(CustomerDataConverter.RowToAddressList(dr));
        }
Example #10
0
 public List <Customer> GetList(Passport passport, string key)
 {
     return(CustomerDataConverter.RowToCustomerList(dal.GetCustomerList(passport, key)));
 }
Example #11
0
 public List <Bill> GetList(Passport passport, string key)
 {
     return(CustomerDataConverter.RowToBillList(dal.GetBillList(passport, key)));
 }
Example #12
0
 public Bill Find(Passport passport, string key)
 {
     return(CustomerDataConverter.RowToBillList(dal.GetBill(key))[0]);
 }
Example #13
0
 public CustomerBill GetCustomerBillById(string id)
 {
     return(CustomerDataConverter.TableToCustomerBill(dal.GetCustomerBillById(id)));
 }
Example #14
0
 public List <BillGoods> GetListByBillCustomerId(Passport passport, string billCustomerId)
 {
     return(CustomerDataConverter.RowToBillGoodsList(dal.GetBillGoodsList(billCustomerId)));
 }
Example #15
0
        public BillGoods Find(Passport passport, string id)
        {
            List <BillGoods> list = CustomerDataConverter.RowToBillGoodsList(dal.GetBillGoods(id));

            return(list.Count > 0 ? list[0] : null);
        }
Example #16
0
        public Customer FindByName(Passport passport, string key)
        {
            List <Customer> list = CustomerDataConverter.RowToCustomerList(dal.GetCustomerByName(passport, key));

            return(list.Count > 0 ? list[0] : null);
        }
Example #17
0
 public List <Customer> GetAll(Passport passport)
 {
     return(CustomerDataConverter.RowToCustomerList(dal.GetCustomerAll(passport)));
 }
Example #18
0
 public List <Bill> GetOpenBillList(Passport passport)
 {
     return(CustomerDataConverter.RowToBillList(dal.GetOpenBillList(passport)));
 }
Example #19
0
 public List <Express> GetAll(Passport passport)
 {
     return(CustomerDataConverter.RowToExpressList(dal.GetExpress(passport, "")));
 }
Example #20
0
 public List <Express> GetList(Passport passport, string key)
 {
     return(CustomerDataConverter.RowToExpressList(dal.GetExpress(passport, key)));
 }
Example #21
0
        public List <Address> GetAll(Passport passport)
        {
            MySqlDataReader dr = dal.GetAddressList(passport);

            return(CustomerDataConverter.RowToAddressList(dr));
        }
Example #22
0
 public List <Position> GetAll(Passport passport)
 {
     return(CustomerDataConverter.RowToPositionList(dal.GetAll(passport)));
 }
Example #23
0
        public List <Address> GetSendList(string id)
        {
            MySqlDataReader dr = dal.GetSendAddressListByDocNo(id);

            return(CustomerDataConverter.RowToAddressList(dr));
        }
Example #24
0
        public Goods FindByName(Passport passport, string key)
        {
            List <Goods> list = CustomerDataConverter.RowToGoodsList(dal.GetGoodsByName(passport, key));

            return(list.Count > 0 ? list[0] : null);
        }
Example #25
0
        public User WxLogin(User user)
        {
            List <User> result = CustomerDataConverter.RowToUserList(dal.WxLogin(user));

            return(result.Count == 0 ? null : result[0]);
        }
Example #26
0
 public BillCustomer GetBillCustomerByBillIdAndCustomerId(Passport passport, BillCustomer item)
 {
     return(CustomerDataConverter.RowToBillCustomerWithGoods(dal.GetBillCustomerByBillIdAndCustomerId(item)));
 }