/// <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()); } }
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]); }
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); }
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()); } }
public List <Goods> GetList(Passport passport, string key) { return(CustomerDataConverter.RowToGoodsList(dal.GetGoodsList(passport, key))); }
public List <Goods> GetAll(Passport passport) { return(CustomerDataConverter.RowToGoodsList(dal.GetGoodsAll(passport))); }
public List <BillCustomer> GetListByDocNo(Passport passport, string id) { return(CustomerDataConverter.RowToBillCustomerList(dal.GetBillCustomerList(id))); }
public List <Address> GetList(Passport passport, string customerId) { MySqlDataReader dr = dal.GetAddressListByCustomer(customerId); return(CustomerDataConverter.RowToAddressList(dr)); }
public List <Address> FindByKeyWithUnBind(Passport passport, string key) { MySqlDataReader dr = dal.GetAddressListByKeyWithUnBind(passport, key); return(CustomerDataConverter.RowToAddressList(dr)); }
public List <Customer> GetList(Passport passport, string key) { return(CustomerDataConverter.RowToCustomerList(dal.GetCustomerList(passport, key))); }
public List <Bill> GetList(Passport passport, string key) { return(CustomerDataConverter.RowToBillList(dal.GetBillList(passport, key))); }
public Bill Find(Passport passport, string key) { return(CustomerDataConverter.RowToBillList(dal.GetBill(key))[0]); }
public CustomerBill GetCustomerBillById(string id) { return(CustomerDataConverter.TableToCustomerBill(dal.GetCustomerBillById(id))); }
public List <BillGoods> GetListByBillCustomerId(Passport passport, string billCustomerId) { return(CustomerDataConverter.RowToBillGoodsList(dal.GetBillGoodsList(billCustomerId))); }
public BillGoods Find(Passport passport, string id) { List <BillGoods> list = CustomerDataConverter.RowToBillGoodsList(dal.GetBillGoods(id)); return(list.Count > 0 ? list[0] : null); }
public Customer FindByName(Passport passport, string key) { List <Customer> list = CustomerDataConverter.RowToCustomerList(dal.GetCustomerByName(passport, key)); return(list.Count > 0 ? list[0] : null); }
public List <Customer> GetAll(Passport passport) { return(CustomerDataConverter.RowToCustomerList(dal.GetCustomerAll(passport))); }
public List <Bill> GetOpenBillList(Passport passport) { return(CustomerDataConverter.RowToBillList(dal.GetOpenBillList(passport))); }
public List <Express> GetAll(Passport passport) { return(CustomerDataConverter.RowToExpressList(dal.GetExpress(passport, ""))); }
public List <Express> GetList(Passport passport, string key) { return(CustomerDataConverter.RowToExpressList(dal.GetExpress(passport, key))); }
public List <Address> GetAll(Passport passport) { MySqlDataReader dr = dal.GetAddressList(passport); return(CustomerDataConverter.RowToAddressList(dr)); }
public List <Position> GetAll(Passport passport) { return(CustomerDataConverter.RowToPositionList(dal.GetAll(passport))); }
public List <Address> GetSendList(string id) { MySqlDataReader dr = dal.GetSendAddressListByDocNo(id); return(CustomerDataConverter.RowToAddressList(dr)); }
public Goods FindByName(Passport passport, string key) { List <Goods> list = CustomerDataConverter.RowToGoodsList(dal.GetGoodsByName(passport, key)); return(list.Count > 0 ? list[0] : null); }
public User WxLogin(User user) { List <User> result = CustomerDataConverter.RowToUserList(dal.WxLogin(user)); return(result.Count == 0 ? null : result[0]); }
public BillCustomer GetBillCustomerByBillIdAndCustomerId(Passport passport, BillCustomer item) { return(CustomerDataConverter.RowToBillCustomerWithGoods(dal.GetBillCustomerByBillIdAndCustomerId(item))); }