public JsonResult Addstore(Storehouse model) { var result = false; try { Storehouse newStore = new Storehouse(); newStore.name = model.name; newStore.place = model.place; newStore.Description = model.Description; _db.Storehouse.Add(newStore); _db.SaveChanges(); result = true; } catch (Exception ex) { throw ex; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public Storehouse SelectStorehouse(int id, IDbConnection conn) { string sql = @" select ID,StorehouseCode,StorehouseName,Actived,Remark from MD_Storehouse where ID=@ID"; List <SqlParameter> paramList = new List <SqlParameter>(); paramList.Add(new SqlParameter("@ID", id)); SqlDataReader reader = DataAccessUtil.ExecuteReader(sql, paramList, (SqlConnection)conn); Storehouse house = null; while (reader.Read()) { house = new Storehouse(); house.ID = reader.GetInt32(0); house.Code = reader.GetString(1); house.Name = reader.GetString(2); house.Actived = reader.GetBoolean(3); if (!reader.IsDBNull(4)) { house.Remark = reader.GetString(4); } } reader.Close(); return(house); }
public static int Add(Storehouse stroe) { CangChuEntities1 contxt = new CangChuEntities1(); contxt.Storehouse.Add(stroe); return(contxt.SaveChanges()); }
private void IsExistsCode(ISession session, Storehouse sh) { ICriteria criteria = session.CreateCriteria(typeof(Storehouse)); ICriterion criterion = null; if (sh.Id != Guid.Empty) { criterion = Restrictions.Not(Restrictions.IdEq(sh.Id)); criteria.Add(criterion); } criterion = Restrictions.Eq("StoreCode", sh.StoreCode); criteria.Add(criterion); //统计 criteria.SetProjection( Projections.ProjectionList() .Add(Projections.Count("Id")) ); int count = (int)criteria.UniqueResult(); if (count > 0) { throw new EasyJob.Tools.Exceptions.StorehouseCodeIsExistsException();//库存Code已经存在 } }
public List <Storehouse> SearchStorehouse(string codeCond, string nameCond, IDbConnection conn) { string sql = @"select ID,StorehouseCode,StorehouseName,Actived,Remark from MD_Storehouse where StorehouseCode like @StorehouseCode or StorehouseName like @StorehouseName"; List <SqlParameter> paramList = new List <SqlParameter>(); paramList.Add(new SqlParameter("@StorehouseCode", string.Format("%{0}%", codeCond))); paramList.Add(new SqlParameter("@StorehouseName", string.Format("%{0}%", nameCond))); SqlDataReader reader = DataAccessUtil.ExecuteReader(sql, paramList, (SqlConnection)conn); List <Storehouse> houseList = new List <Storehouse>(); while (reader.Read()) { Storehouse house = new Storehouse(); house.ID = reader.GetInt32(0); house.Code = reader.GetString(1); house.Name = reader.GetString(2); house.Actived = reader.GetBoolean(3); if (!reader.IsDBNull(4)) { house.Remark = reader.GetString(4); } houseList.Add(house); } reader.Close(); return(houseList); }
public Storehouse SelectStorehouse(string code, IDbConnection conn) { string sql = @" SELECT ID,StorehouseCode,StorehouseName,Actived,Remark FROM MD_Storehouse WHERE StorehouseCode=@Code"; List <SqlParameter> paramList = new List <SqlParameter>(); paramList.Add(new SqlParameter("@Code", code)); SqlDataReader reader = DataAccessUtil.ExecuteReader(sql, paramList, (SqlConnection)conn); Storehouse result = null; while (reader.Read()) { result = new Storehouse(); result.ID = reader.GetInt32(0); result.Code = reader.GetString(1); result.Name = reader.GetString(2); result.Actived = reader.GetBoolean(3); if (!reader.IsDBNull(4)) { result.Remark = reader.GetString(4); } } reader.Close(); return(result); }
/// <summary> /// 增加一个药品仓库 /// </summary> /// <param name="storeHouse"></param> /// <param name="creator"></param> public void CreateStorehouse(Storehouse storeHouse, string creator) { using (IDbConnection conn = DAOFactory.Instance.OpenConnection()) { IStorehouseDAO dao = DAOFactory.Instance.CreateStorehouseDAO(); dao.InsertStorehouse(storeHouse, conn); } }
/// <summary> /// 保存修改过的药品仓库 /// </summary> /// <param name="Storehouse"></param> /// <param name="modifier"></param> public void SaveStorehouse(Storehouse storehouse, string modifier) { using (IDbConnection conn = DAOFactory.Instance.OpenConnection()) { IStorehouseDAO dao = DAOFactory.Instance.CreateStorehouseDAO(); dao.UpdateStorehouse(storehouse, conn); } }
/// <summary> /// 删除一条药品仓库 /// </summary> /// <param name="Storehouse"></param> /// <param name="deleter"></param> public void DeleteStorehouse(Storehouse storehouse, string deleter) { using (IDbConnection conn = DAOFactory.Instance.OpenConnection()) { IStorehouseDAO dao = DAOFactory.Instance.CreateStorehouseDAO(); dao.DeleteStorehouse(storehouse.ID, conn); } }
public PreOrderModel(IUnityContainer unityContainer) : base(unityContainer) { ViewCode = ViewConst.CR_PRE_ORDER; this.unityContainer = unityContainer; StoreHouseType = Storehouse.Cold; _serverDate = DateTime.Parse(unityContainer.Resolve <IOrderUserInfo>().Property["SERVER_DATE"]); _shopId = Guid.Parse(unityContainer.Resolve <IOrderUserInfo>().Property["USER_SHOP"]); }
/// <summary> /// 用于修改 /// </summary> /// <param name="model"></param> public FrmStorehouse(Storehouse model) { InitializeComponent(); this._Model = model; this.Text = string.Format(this.Text, "修改"); this.txtCode.Text = model.Code; this.txtName.Text = model.Name; this.txtRemark.Text = model.Remark; }
/// <summary> /// 用于修改 /// </summary> /// <param name="model"></param> public FrmStorehouse(Storehouse model) { InitializeComponent(); this.Text = string.Format(this.Text, "修改仓库"); this.Model = model; this.txtCode.Text = model.Code; this.txtName.Text = model.Name; this.ckbActived.Checked = model.Actived; this.txtRemark.Text = model.Remark; }
public static int update(Storehouse s) { CangChuEntities1 entity = new CangChuEntities1(); var obj = (from p in entity.Storehouse where p.StorId == s.StorId select p).First(); obj.StoreName = s.StoreName; obj.StId = s.StId; obj.IsMoren = s.IsMoren; obj.Supid = s.Supid; return(entity.SaveChanges()); }
private void addDataForUpdate() { Storehouse c = query.queryFindStorehouseById(Id); if (c == null) { return; } textBox1.Text = c.Name; textBox2.Text = c.Address; }
public async Task <string> UpdateStoreHouse([FromBody] Storehouse StoreHouse) { //var user = context.Storehouse.Single(o => o.Component == Convert.ToInt32(StoreHouse.Component)); if (StoreHouse == null) { return("没有此用户"); } context.Entry <Storehouse>(StoreHouse).State = EntityState.Modified;//整个对象更新 var reul = await context.SaveChangesAsync(); return("操作成功数据库返回结果:" + reul); }
public void InsertStorehouse(Storehouse house, IDbConnection conn, IDbTransaction trans) { string sql = @" Insert into MD_Storehouse(StorehouseCode,StorehouseName,Actived,Remark) values(@StorehouseCode,@StorehouseName,@Actived,@Remark) "; List <SqlParameter> paramList = new List <SqlParameter>(); paramList.Add(new SqlParameter("@StorehouseCode", house.Code)); paramList.Add(new SqlParameter("@StorehouseName", house.Name)); paramList.Add(new SqlParameter("@Actived", house.Actived)); paramList.Add(new SqlParameter("@Remark", house.Remark)); DataAccessUtil.ExecuteNonQuery(sql, paramList, (SqlTransaction)trans); }
public async Task <string> CreateStoreHouse([FromBody] Storehouse StoreHouse) { var StoreH = context.Storehouse.Where(o => o.Comname == StoreHouse.Comname); if (StoreH.Count() != 0) { return("已存在此记录"); } context.Storehouse.Add(StoreHouse); await context.SaveChangesAsync(); return("添加用户成功,ID" + StoreHouse.Component); }
private static void Stop() { Working = false; foreach (var wizar in wizards) { wizar.Stop(); } foreach (var factory in factories) { factory.Stop(); } Storehouse.StopWork(); }
private static void Start() { new Thread(AlchemistSpamer).Start(); Storehouse.StartWorkAsync(); foreach (var factory in factories) { new Thread(factory.Run).Start(); } foreach (var wizard in wizards) { new Thread(wizard.Run).Start(); } }
public void InsertStorehouse(Storehouse storehouse, IDbConnection conn) { string sql = @" INSERT INTO MD_Storehouse(StorehouseCode,StorehouseName,Actived,Remark) VALUES(@StorehouseCode,@StorehouseName,@Actived,@Remark)"; List <SqlParameter> paramList = new List <SqlParameter>(); paramList.Add(new SqlParameter("@StorehouseCode", storehouse.Code)); paramList.Add(new SqlParameter("@StorehouseName", storehouse.Name)); paramList.Add(new SqlParameter("@Actived", storehouse.Actived)); paramList.Add(new SqlParameter("@Remark", storehouse.Remark)); DataAccessUtil.ExecuteNonQuery(sql, paramList, (SqlConnection)conn); }
public bool Modify(StorehouseModel model) { Storehouse oldValue = DB.Storehouse.SingleOrDefault(o => o.ID == model.ID); if (oldValue != null) { oldValue.Name = model.Name; oldValue.Address = model.Address; oldValue.Master = model.Master; oldValue.Capacity = model.Capacity; } return(DB.SaveChanges() == 1); }
public override bool CheckForNeighbouringBuildings() { Debug.Log("Checks for Storehouse"); List <Storehouse> chainBuildings = GetNeighbouringBuildings <Storehouse>(); if (nextInChain == null && chainBuildings.Count >= 1) { Debug.Log(">= 1"); nextInChain = chainBuildings[0]; return(true); } return(false); }
public void UpdateStorehouse(Storehouse house, IDbConnection conn, IDbTransaction trans) { string sql = @" Update MD_Storehouse set StorehouseCode=@StorehouseCode,StorehouseName=@StorehouseName, Actived=@Actived,Remark=@Remark where ID=@ID"; List <SqlParameter> paramList = new List <SqlParameter>(); paramList.Add(new SqlParameter("@StorehouseCode", house.Code)); paramList.Add(new SqlParameter("@StorehouseName", house.Name)); paramList.Add(new SqlParameter("@Actived", house.Actived)); paramList.Add(new SqlParameter("@Remark", house.Remark)); paramList.Add(new SqlParameter("@ID", house.ID)); DataAccessUtil.ExecuteNonQuery(sql, paramList, (SqlTransaction)trans); }
public void UpdateStorehouse(Storehouse storehouse, IDbConnection conn) { string sql = @" UPDATE MD_Storehouse SET StorehouseCode=@StorehouseCode,StorehouseName=@StorehouseName, Actived=@Actived,Remark=@Remark WHERE ID=@ID"; List <SqlParameter> paramList = new List <SqlParameter>(); paramList.Add(new SqlParameter("@StorehouseCode", storehouse.Code)); paramList.Add(new SqlParameter("@StorehouseName", storehouse.Name)); paramList.Add(new SqlParameter("@Actived", storehouse.Actived)); paramList.Add(new SqlParameter("@Remark", storehouse.Remark)); paramList.Add(new SqlParameter("@ID", storehouse.ID)); DataAccessUtil.ExecuteNonQuery(sql, paramList, (SqlConnection)conn); }
private void btnOK_Click(object sender, EventArgs e) { try { //Verify if (string.IsNullOrEmpty(this.txtCode.Text.Trim())) { throw new ApplicationException("编码不能为空"); } if (string.IsNullOrEmpty(this.txtName.Text.Trim())) { throw new ApplicationException("名称不能为空"); } ModelService service = new ModelService(); //Save if (this._Model == null) //新建 { if (service.GetStorehouseByCode(this.txtCode.Text.Trim()) != null) { throw new ApplicationException(string.Format("编码{0}已经被使用,请尝试其他编码。", this.txtCode.Text.Trim())); } Storehouse newModel = new Storehouse(); newModel.Code = this.txtCode.Text.Trim(); newModel.Name = this.txtName.Text.Trim(); newModel.Remark = this.txtRemark.Text.Trim(); newModel.Actived = true; service.CreateStorehouse(newModel, PermissionService.GetCurrentUser().Name); } else//修改 { this._Model.Code = this.txtCode.Text.Trim(); this._Model.Name = this.txtName.Text.Trim(); this._Model.Remark = this.txtRemark.Text.Trim(); service.SaveStorehouse(this._Model, PermissionService.GetCurrentUser().Name); } //Close dialog this.DialogResult = DialogResult.OK; } catch (Exception ex) { ErrorHandler.OnError(ex); } }
public ActionResult Update(Storehouse storehouse) { //根据地址码获取地址 storehouse.Addr = PojoUtil.GetAddrForCode(HibernateOper, storehouse.AddrCode); LocationUtil.Location loc = LocationUtil.GetLocation(storehouse.Addr + storehouse.Location); if (loc != null) { storehouse.Lat = loc.lat; storehouse.Lng = loc.lng; } return(Json(storehouseOper.Update(storehouse, delegate(object sender, ISession session) { //判断是否存在库存Code IsExistsCode(session, storehouse); } ))); }
public override int GetHashCode() { int hash = 1; if (Storehouse != 0) { hash ^= Storehouse.GetHashCode(); } if (Processblock != 0) { hash ^= Processblock.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private List <Storehouse> GetSelectModelList() { List <Storehouse> selectedModelList = new List <Storehouse>(); foreach (DataGridViewRow row in dataGridView1.Rows) { DataGridViewCheckBoxCell cell = (DataGridViewCheckBoxCell)row.Cells[0]; if (cell.EditedFormattedValue != null && (bool)cell.EditedFormattedValue == true) { Storehouse selectedModel = (Storehouse)row.Tag; selectedModelList.Add(selectedModel); } } if (selectedModelList.Count == 0) { throw new ApplicationException("请选择要操作的内容。"); } return(selectedModelList); }
private void buttonOK_Click(object sender, EventArgs e) { Storehouse c = new Storehouse(); c.Name = textBox1.Text; c.Address = textBox2.Text; if (Id == -1) { query.queryAddStorehouse(c); } else { c.Id = Id; query.queryUpdateStorehouse(c); } instance.refreshGrid(); this.Dispose(); }
/// <summary> /// operationsQuantity should be greater than jobsQuantity /// familiesQuantity can be 0 -> then no families scheduling /// isComplexProduction - complex production, else small scale production /// </summary> private static ModelAssociation GenerateFor(DateTime startProcessingDate, int materialsQuantity, int machinesQuantity, int jobsQuantity, int operationsQuantity, int familiesQuantity, bool isComplexProduction) { List <Material> CurrentMaterials = MaterialFactory.GenerateFor(materialsQuantity); Storehouse CurrentStorehouse = StorehouseFactory.GenerateFor(CurrentMaterials); List <Machine> CurrentMachines; List <Operation> CurrentOperations; List <Job> CurrentJobs; if (isComplexProduction) { CurrentMachines = MachineFactory.GenerateComplexProductionFor(startProcessingDate, machinesQuantity); CurrentOperations = OperationFactory.GenerateComplexProductionFor(CurrentMachines, CurrentMaterials, null, null, operationsQuantity); CurrentJobs = JobFactory.GenerateComplexProductionFor(CurrentOperations, null, jobsQuantity); } else { CurrentMachines = MachineFactory.GenerateSmallScaleProductionFor(startProcessingDate, machinesQuantity); CurrentOperations = OperationFactory.GenerateSmallScaleProductionFor(CurrentMachines, CurrentMaterials, null, null, operationsQuantity); CurrentJobs = JobFactory.GenerateSmallScaleProductionFor(CurrentOperations, null, jobsQuantity); } List <Batch> CurrentBatches; if (familiesQuantity > 0) { List <Family> CurrentFamilies; if (isComplexProduction) { CurrentFamilies = FamilyFactory.GenerateComplexProductionFor(CurrentMachines, familiesQuantity); } else { CurrentFamilies = FamilyFactory.GenerateSmallScaleProductionFor(CurrentMachines, familiesQuantity); } CurrentBatches = BatchFactory.GenerateWithFamiliesFor(startProcessingDate, CurrentJobs, CurrentFamilies); } else { CurrentBatches = BatchFactory.GenerateWithoutFamiliesFor(startProcessingDate, CurrentJobs); } return(new ModelAssociation(CurrentBatches, CurrentMachines, CurrentStorehouse)); }
private void SetStorehouse(Storehouse storeType) { Model.StoreHouseType = storeType; ReloadGrid(); }