Exemplo n.º 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());
            }
        }
Exemplo n.º 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]);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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());
            }
        }
Exemplo n.º 5
0
 public List <Goods> GetList(Passport passport, string key)
 {
     return(CustomerDataConverter.RowToGoodsList(dal.GetGoodsList(passport, key)));
 }
Exemplo n.º 6
0
 public List <Goods> GetAll(Passport passport)
 {
     return(CustomerDataConverter.RowToGoodsList(dal.GetGoodsAll(passport)));
 }
Exemplo n.º 7
0
 public List <BillCustomer> GetListByDocNo(Passport passport, string id)
 {
     return(CustomerDataConverter.RowToBillCustomerList(dal.GetBillCustomerList(id)));
 }
Exemplo n.º 8
0
        public List <Address> GetList(Passport passport, string customerId)
        {
            MySqlDataReader dr = dal.GetAddressListByCustomer(customerId);

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

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

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

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

            return(CustomerDataConverter.RowToAddressList(dr));
        }
Exemplo n.º 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);
        }
Exemplo n.º 25
0
        public User WxLogin(User user)
        {
            List <User> result = CustomerDataConverter.RowToUserList(dal.WxLogin(user));

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