public void UpdateDataTable(System.Data.DataTable dt) { try { V.BeginTransaction(); accessor.UpdateDataTable(dt); foreach (DataRow item in dt.Rows) { Model.Stock stock = stockAccessor.GetStockByProductIdAndDepotPositionId(item["ProductId"].ToString(), item["DepotPositionId"].ToString()); if (stock != null) { stock.StockQuantity1 = double.Parse(item["StockCheckQuantity"].ToString()); stockAccessor.Update(stock); } Model.Product product = productAccessor.Get(item["ProductId"].ToString()); Model.Depot depot = depotAccessor.Get(item["DepotId"].ToString()); if (product != null) { product.StocksQuantity = stockAccessor.GetTheCount1OfProductByProductId(product, depot); productAccessor.Update(product); } } V.CommitTransaction(); } catch (Exception) { V.RollbackTransaction(); throw; } }
protected override void AddNew() { this.depot = new Model.Depot(); this.depot.DepotId = Guid.NewGuid().ToString(); this.depot.Details = new List <Model.DepotPosition>(); this.depot.IsFinalProductDepot = false; }
public bool existsInsertName(string DepotPositionid, Model.Depot depot) { Hashtable ht = new Hashtable(); ht.Add("DepotPositionid", DepotPositionid); ht.Add("depotid", depot == null ? null : depot.DepotId); return(sqlmapper.QueryForObject <bool>("DepotPosition.existsInsertName", ht)); }
public bool ExistsExcept(Model.Depot e) { Hashtable paras = new Hashtable(); paras.Add("newId", e.Id); paras.Add("oldId", Get(e.DepotId) == null?null:Get(e.DepotId).Id); return(sqlmapper.QueryForObject <bool>("Depot.existsexcept", paras)); }
public double GetTheCount0OfProductByProductId(Model.Product product, Model.Depot depot) { Hashtable ht = new Hashtable(); ht.Add("productId", product == null ? null : product.ProductId); ht.Add("depotId", depot.DepotId); return(sqlmapper.QueryForObject <double>("Stock.GetTheCount0OfProductByProductId", ht)); }
private void buttonEditDepot_EditValueChanged(object sender, EventArgs e) { if (this.buttonEditDepot.EditValue != null) { Model.Depot depot = this.buttonEditDepot.EditValue as Model.Depot; this.bindingSourceDepotPosition.DataSource = new BL.DepotPositionManager().Select(depot); } }
protected override void MovePrev() { Model.Depot dt = this.depotManager.GetPrev(this.depot); if (dt == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.depot = dt; }
public void MyClick(ref ChooseItem item) { ChooseDepotForm f = new ChooseDepotForm(); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Model.Depot depot = f.SelectedItem as Model.Depot; item = new ChooseItem(depot, depot.Id, depot.DepotName); } }
/// <summary> /// Update a Depot. /// </summary> public void Update(Model.Depot depot) { // // todo: add other logic here. // Validate(depot); if (this.ExistsExcept(depot)) { throw new Helper.InvalidValueException(Model.Depot.PRO_Id); } foreach (Model.DepotPosition dp in depot.Details) { if (string.IsNullOrEmpty(dp.Id)) { throw new Helper.RequireValueException(Model.DepotPosition.PROPERTY_ID + "aa"); } //if (DepotPositionAccessor.existsInsertName(dp.DepotPositionId, depot)) //{ // if (DepotPositionAccessor.ExistsExcept(dp)) // { // throw new Helper.InvalidValueException(Model.DepotPosition.PROPERTY_ID + "aa"); // } //} } depot.UpdateTime = DateTime.Now; accessor.Update(depot); if (depot.Details != null) { List <string> str = new List <string>(); foreach (Model.DepotPosition dp in depot.Details) { if (DepotPositionAccessor.existsInsertName(dp.DepotPositionId, depot)) { dp.DepotId = depot.DepotId; DepotPositionAccessor.Update(dp); } else { dp.DepotId = depot.DepotId; DepotPositionAccessor.Insert(dp); } str.Add(dp.DepotPositionId); } foreach (Model.DepotPosition DepotPosition in DepotPositionAccessor.Select(depot)) { if (!str.Contains(DepotPosition.DepotPositionId)) { DepotPositionAccessor.Delete(DepotPosition.DepotPositionId); } } } }
private void Validate(Model.Depot depot) { if (string.IsNullOrEmpty(depot.Id)) { throw new Helper.RequireValueException(Model.Depot.PRO_Id); } //if (string.IsNullOrEmpty(depot.)) //{ // throw new Helper.RequireValueException(Model.Depot.PROPERTY_DEPOTNAME); //} }
private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { if (flag == 0) { if (e.Node.Tag != null) { this.action = "view"; depot = this.depotManager.SelectByDepot(e.Node.Tag.ToString()); //this.bindingSource1.DataSource = this.depotPositionManager.Select(depot.DepotId); this.Refresh(); } } }
private void newChooseContorlDepot_EditValueChanged(object sender, EventArgs e) { Model.Depot depot = this.newChooseContorlDepot.EditValue as Model.Depot; if (depot != null) { this.newChooseContorlDepotPosition.Choose = new Book.UI.Invoices.ChooseDepotPosition(depot); this.newChooseContorlDepotPosition.EditValue = null; } else { this.newChooseContorlDepotPosition.Choose = null; this.newChooseContorlDepotPosition.EditValue = null; } }
public void MyLeave(ref ChooseItem item) { BL.DepotManager manager = new Book.BL.DepotManager(); Model.Depot depot = manager.GetById(item.ButtonText); if (depot != null) { item.EditValue = depot; item.LabelText = depot.DepotName; item.ButtonText = depot.Id; } else { item.ErrorMessage = Properties.Resources.ChooseDepotError; } }
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.ListSourceRowIndex < 0) { return; } IList <Model.ProduceOtherMaterial> list = this.bindingSourceProduceOtherMaterial.DataSource as IList <Model.ProduceOtherMaterial>; if (list == null || list.Count == 0) { return; } Model.Employee employee0 = list[e.ListSourceRowIndex].Employee0; Model.Employee employee1 = list[e.ListSourceRowIndex].Employee1; Model.WorkHouse workHouse = list[e.ListSourceRowIndex].WorkHouse; Model.Depot depot = list[e.ListSourceRowIndex].Depot; switch (e.Column.Name) { case "gridColumnDepot": if (depot != null) { e.DisplayText = string.IsNullOrEmpty(depot.DepotId) ? "" : depot.ToString(); } break; case "gridColumnEmployee0Id": if (employee0 != null) { e.DisplayText = string.IsNullOrEmpty(employee0.EmployeeId) ? "" : employee0.ToString(); } break; case "gridColumnWorkHouseId": if (workHouse != null) { e.DisplayText = string.IsNullOrEmpty(workHouse.WorkHouseId) ? "" : workHouse.ToString(); } break; case "gridColumnEmployee1Id": if (employee1 != null) { e.DisplayText = string.IsNullOrEmpty(employee1.EmployeeId) ? "" : employee1.ToString(); } break; } }
private void buttonEditDepot_EditValueChanged(object sender, EventArgs e) { Model.Depot depot = this.buttonEditDepot.EditValue as Model.Depot; if (depot != null) { this.bindingSourceDepotPosition.DataSource = this.depotPositionManager.Select(depot); } else { this.bindingSourceDepotPosition.Clear(); foreach (Model.InvoiceXTDetail detail in this.invoice.Details) { detail.DepotPosition = null; detail.DepotPositionId = null; } } }
/// <summary> /// Insert a Depot. /// </summary> public void Insert(Model.Depot depot) { // // todo:add other logic here // Validate(depot); if (this.Exists(depot.Id)) { throw new Helper.InvalidValueException(Model.Depot.PRO_Id); } foreach (Model.DepotPosition dp in depot.Details) { if (string.IsNullOrEmpty(dp.Id)) { throw new Helper.RequireValueException(Model.DepotPosition.PROPERTY_ID + "aa"); } if (DepotPositionAccessor.existsInsertName(dp.Id, depot)) { throw new Helper.InvalidValueException(Model.DepotPosition.PROPERTY_ID + "aa"); } } try { BL.V.BeginTransaction(); depot.InsertTime = DateTime.Now; accessor.Insert(depot); if (depot.Details != null) { foreach (Model.DepotPosition dp in depot.Details) { dp.DepotPositionId = Guid.NewGuid().ToString(); dp.DepotId = depot.DepotId; DepotPositionAccessor.Insert(dp); } } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
protected override void Delete() { if (this.depot == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) { return; } this.depotManager.Delete(this.depot); this.depot = this.depotManager.GetNext(this.depot); if (this.depot == null) { this.depot = this.depotManager.GetLast(); } flag = 1; band(); }
public ChooseDepotPositionForm(Model.Depot depot) { InitializeComponent(); this.manager = new BL.DepotPositionManager(); this._depot = depot; }
public Model.Depot GetPrev(Model.Depot e) { return(sqlmapper.QueryForObject <Model.Depot>("Depot.get_prev", e)); }
public Model.Depot GetNext(Model.Depot e) { return(sqlmapper.QueryForObject <Model.Depot>("Depot.get_next", e)); }
public bool HasRowsAfter(Model.Depot e) { return(sqlmapper.QueryForObject <bool>("Depot.has_rows_after", e)); }
public bool HasRowsBefore(Model.Depot e) { return(sqlmapper.QueryForObject <bool>("Depot.has_rows_before", e)); }
public void Update(Model.Depot e) { this.Update <Model.Depot>(e); }
public void Insert(Model.Depot e) { this.Insert <Model.Depot>(e); }
public IList <Model.Product> Select(Model.Depot depot) { return(accessor.Select(depot)); }
public IList <Book.Model.InvoiceXSDetail> Select(DateTime startDate, DateTime endDate, Model.Employee employee, Model.Customer customer, Model.Depot depot) { Hashtable pars = new Hashtable(); pars.Add("startdate", startDate); pars.Add("enddate", endDate); pars.Add("customerid", customer == null ? null : customer.CustomerId); pars.Add("employeeId", employee == null ? null : employee.EmployeeId); pars.Add("depotid", depot == null ? null : depot.DepotId); return(sqlmapper.QueryForList <Model.InvoiceXSDetail>("InvoiceXSDetail.selectByCustomEmpDepetQuJian", pars)); }
protected override void MoveFirst() { this.depot = this.depotManager.GetFirst(); }
public IList <Book.Model.ProduceInDepotDetail> SelectList(string startPronoteHeader, string endPronoteHeader, DateTime startDate, DateTime endDate, Model.Product product, Model.WorkHouse work, Model.Depot mDepot, Model.DepotPosition mDepotPosition, string id1, string id2, string cusxoid, Model.Customer customer1, Model.Customer customer2, int ProductState, string handBookId) { return(accessor.SelectList(startPronoteHeader, endPronoteHeader, startDate, endDate, product, work, mDepot, mDepotPosition, id1, id2, cusxoid, customer1, customer2, ProductState, handBookId)); }
protected override void MoveLast() { this.depot = this.depotManager.GetLast(); }
public override void Refresh() { if (this.depot == null) { this.depot = new Book.Model.Depot(); this.depot.Details = new List <Model.DepotPosition>(); this.action = "insert"; } else { if (this.action == "view") { this.depot = this.depotManager.GetDetails(depot.DepotId); } } if (this.action == "insert" || (this.action == "update" && this.depot.Details.Count == 0)) { Model.DepotPosition detail = new Model.DepotPosition(); detail.DepotPositionId = Guid.NewGuid().ToString(); detail.Depot = this.depot; this.depot.Details.Add(detail); this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); } this.textEditId.Text = this.depot.Id; this.textEditDepotName.Text = this.depot.DepotName; //this.textEditKeeper.Text = this.depot.StoreKeeper; this.textEditFax.Text = this.depot.Fax; this.textEditTelphone.Text = this.depot.Telphone; this.textEditDepotAddress.Text = this.depot.DepotAddress; this.textEditBarCode.Text = this.depot.DepotCode; this.textEditDepotDescription.Text = this.depot.DepotDescription; //this.comboBoxEditDepot.Text = this.depot.DepotTypeName; // this.radioGroup1.SelectedIndex =this.depot.IsFinalProductDepot==true?1:0 ; this.bindingSource1.DataSource = this.depot.Details; this.gridControl1.RefreshDataSource(); flag = 1; if (this.action != "view") { band(); } this.textEditDepotName.EditValue = this.depot.DepotName; flag = 0; switch (this.action) { case "insert": this.textEditId.Properties.ReadOnly = false; this.textEditDepotName.Properties.ReadOnly = false; //this.textEditKeeper.Properties.ReadOnly = false; this.textEditFax.Properties.ReadOnly = false; this.textEditTelphone.Properties.ReadOnly = false; this.textEditDepotAddress.Properties.ReadOnly = false; this.textEditDepotDescription.Properties.ReadOnly = false; this.textEditBarCode.Properties.ReadOnly = false; //this.comboBoxEditDepot.Properties.ReadOnly = false; //this.comboBoxEditDepot.Properties.Buttons[0].Visible = true; this.gridView1.OptionsBehavior.Editable = true; break; case "update": this.textEditId.Properties.ReadOnly = false; this.textEditDepotName.Properties.ReadOnly = false; //this.textEditKeeper.Properties.ReadOnly = false; this.textEditFax.Properties.ReadOnly = false; this.textEditTelphone.Properties.ReadOnly = false; this.textEditDepotAddress.Properties.ReadOnly = false; this.textEditDepotDescription.Properties.ReadOnly = false; this.textEditBarCode.Properties.ReadOnly = false; //this.comboBoxEditDepot.Properties.ReadOnly = false; //this.comboBoxEditDepot.Properties.Buttons[0].Visible = true; this.gridView1.OptionsBehavior.Editable = true; break; case "view": this.textEditId.Properties.ReadOnly = true; this.textEditDepotName.Properties.ReadOnly = true; //this.textEditKeeper.Properties.ReadOnly = true; this.textEditFax.Properties.ReadOnly = true; this.textEditTelphone.Properties.ReadOnly = true; this.textEditDepotAddress.Properties.ReadOnly = true; this.textEditDepotDescription.Properties.ReadOnly = true; this.textEditBarCode.Properties.ReadOnly = true; //this.comboBoxEditDepot.Properties.ReadOnly = true; //this.comboBoxEditDepot.Properties.Buttons[0].Visible = false; this.gridView1.OptionsBehavior.Editable = false; break; default: break; } base.Refresh(); }