public string AddWareHouse(string warecode, string name, string shortname, string citycode, int status, string depotcode, string depotname, string description, string operateid, string clientid) { var id = Guid.NewGuid().ToString(); if (SystemDAL.BaseProvider.AddWareHouse(id, warecode, name, shortname, citycode, status, depotcode, depotname, description, operateid, clientid)) { if (!WareHouses.ContainsKey(clientid)) { GetWareHouses(clientid); } var model = new WareHouse() { WareID = id, WareCode = warecode, Name = name, ShortName = shortname, CityCode = citycode, Status = status, Description = description, CreateUserID = operateid, ClientID = clientid, CreateTime = DateTime.Now }; WareHouses[clientid].Add(model); return id.ToString(); } return string.Empty; }
public WareHouse GetWareByID(string wareid, string clientid) { if (string.IsNullOrEmpty(wareid)) { return null; } wareid = wareid.ToLower(); clientid = clientid.ToLower(); var list = GetWareHouses(clientid); if (list.Where(m => m.WareID == wareid).Count() > 0) { return list.Where(m => m.WareID == wareid).FirstOrDefault(); } DataTable dt = SystemDAL.BaseProvider.GetWareByID(wareid); WareHouse model = new WareHouse(); if (dt.Rows.Count > 0) { model.FillData(dt.Rows[0]); model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault(); list.Add(model); } return model; }
public List<WareHouse> GetWareHouses(string clientID) { clientID = clientID.ToLower(); if (WareHouses.ContainsKey(clientID)) { return WareHouses[clientID]; } DataTable dt = SystemDAL.BaseProvider.GetWareHouses(clientID); List<WareHouse> list = new List<WareHouse>(); foreach (DataRow dr in dt.Rows) { WareHouse model = new WareHouse(); model.FillData(dr); list.Add(model); } WareHouses.Add(clientID, list); return list; }
public List<WareHouse> GetWareHouses(string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientID) { DataSet ds = SystemDAL.BaseProvider.GetWareHouses(keyWords, pageSize, pageIndex, ref totalCount, ref pageCount, clientID); List<WareHouse> list = new List<WareHouse>(); foreach (DataRow dr in ds.Tables[0].Rows) { WareHouse model = new WareHouse(); model.FillData(dr); model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault(); list.Add(model); } return list; }
/// <summary> /// 获取所有仓库(ID和Name) /// </summary> /// <param name="clientID"></param> /// <returns></returns> public List<WareHouse> GetWareHouses(string clientID) { var dal = new WarehouseDAL(); DataTable dt = dal.GetWareHouses(clientID); List<WareHouse> list = new List<WareHouse>(); foreach (DataRow dr in dt.Rows) { WareHouse model = new WareHouse(); model.FillData(dr); list.Add(model); } return list; }
/// <summary> /// 根据ID获取仓库详情 /// </summary> /// <param name="wareid"></param> /// <returns></returns> public WareHouse GetWareByID(string wareid) { var dal = new WarehouseDAL(); DataTable dt = dal.GetWareByID(wareid); WareHouse model = new WareHouse(); if (dt.Rows.Count > 0) { model.FillData(dt.Rows[0]); model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault(); } return model; }