private void StockEditorSettingForm_Load(object sender, EventArgs e) { IList <Model.DepotPosition> list = depotPositionManager.Select(this._depotId); if (list.Count == 0) { return; } foreach (Model.DepotPosition item in list) { Model.StockEditorDetal temp = this._stockEditorDetailManager.SelectByProductIdAndPositionIdAndStockHId(this._stockEditorDetail.ProductId, item.DepotPositionId, this._stockEditorDetail.StockEditorId); if (temp == null) { temp = new Book.Model.StockEditorDetal(); temp.StockEditorDetalId = Guid.NewGuid().ToString(); temp.StockEditorId = this._stockEditorDetail.StockEditorId; temp.DepotPositionId = item.DepotPositionId; temp.ProductId = this._stockEditorDetail.ProductId; temp.Product = this._stockEditorDetail.Product; temp.DepotPosition = item; temp.StockQuantity = this._stockManager.GetStockByProductIdAndDepotPositionId(this._stockEditorDetail.ProductId, item.DepotPositionId) == null ? 0 : this._stockManager.GetStockByProductIdAndDepotPositionId(this._stockEditorDetail.ProductId, item.DepotPositionId).StockQuantity1; temp.Directions = this._stockEditorDetail.Directions; temp.ProductUnitName = this._stockEditorDetail.ProductUnitName; temp.StockEditorQuantity = null; } if (StockEditorForm.dic.ContainsKey(this._stockEditorDetail.ProductId + item.DepotPositionId)) { temp.StockEditorQuantity = StockEditorForm.dic[this._stockEditorDetail.ProductId + item.DepotPositionId].StockEditorQuantity; } this.stockList.Add(temp); } this.bindingSourceStockEditorDetail.DataSource = this.stockList; this.gridControl1.RefreshDataSource(); }
//private bool isEnter = false; private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e) { if (lookUpEditDepotId.EditValue == null) { MessageBox.Show(Properties.Resources.deptNotNull, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); lookUpEditDepotId.Focus(); return; } Model.StockEditorDetal stockEditorDetail = this.bindingSourceDetail.Current as Model.StockEditorDetal; StockEditorSettingForm depotPN = new StockEditorSettingForm(stockEditorDetail, (lookUpEditDepotId.EditValue as Model.Depot).DepotId); if (depotPN.ShowDialog(this) == DialogResult.OK) { //if (SetNums == 0) // stockEditorDetail.StockEditorQuantity = null; //else stockEditorDetail.StockEditorQuantity = SetNums; } //if (this.buttonEditProductCategoryId.EditValue != null) // this.bindingSourceProduct.DataSource = this._productManager.Select(this.buttonEditProductCategoryId.EditValue as Model.ProductCategory); this.gridControl1.RefreshDataSource(); }
/// <summary> /// Update a StockEditor. /// </summary> public void Update(Model.StockEditor stockEditor) { try { BL.V.BeginTransaction(); accessor.Update(stockEditor); foreach (Model.StockEditorDetal stockEditorDetail in stockEditor.ProductPositionNums) { Model.StockEditorDetal temp = stockEditorDetailsAccessor.Get(stockEditorDetail.StockEditorDetalId); if (temp != null) { stockEditorDetailsAccessor.Update(stockEditorDetail); } else { stockEditorDetailsAccessor.Insert(stockEditorDetail); } } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
/// <summary> /// Update a StockEditorDetal. /// </summary> public void Update(Model.StockEditorDetal stockEditorDetal) { // // todo: add other logic here. // accessor.Update(stockEditorDetal); }
/// <summary> /// Insert a StockEditorDetal. /// </summary> public void Insert(Model.StockEditorDetal stockEditorDetal) { // // todo:add other logic here // accessor.Insert(stockEditorDetal); }
private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e.Column == this.gridColumnProductId || e.Column == this.gridColumnProductName) { Model.StockEditorDetal detail = this.gridView1.GetRow(e.RowHandle) as Model.StockEditorDetal; if (detail != null) { Model.Product p = this._productManager.Get(detail.ProductId); detail.StockEditorQuantity = null; detail.Product = p; detail.ProductId = p.ProductId; detail.ProductUnitName = p.DepotUnit.CnName; detail.StockEditorId = _stockEditor.StockEditorId; detail.Directions = p.ProductDescription; this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail); } this.gridControl1.RefreshDataSource(); } }
public StockEditorSettingForm(Model.StockEditorDetal stockEditordetail, string depotId) { InitializeComponent(); this._stockEditorDetail = stockEditordetail; this._depotId = depotId; }
public void Update(Model.StockEditorDetal e) { this.Update <Model.StockEditorDetal>(e); }
public void Insert(Model.StockEditorDetal e) { this.Insert <Model.StockEditorDetal>(e); }