public void Update(Model.SupplierProduct supplierProduct)
        {
            Validate(supplierProduct);
            supplierProduct.UpdateTime = DateTime.Now;

            accessor.Update(supplierProduct);
        }
 private void Validate(Model.SupplierProduct model)
 {
     if (string.IsNullOrEmpty(model.ProductId))
     {
         throw new Helper.RequireValueException(Model.SupplierProduct.PRO_ProductId);
     }
 }
        public void Insert(Model.SupplierProduct supplierProduct)
        {
            Validate(supplierProduct);
            supplierProduct.SupplierProductId = Guid.NewGuid().ToString();
            supplierProduct.InsertTime        = DateTime.Now;
            supplierProduct.UpdateTime        = DateTime.Now;

            accessor.Insert(supplierProduct);
        }
Esempio n. 4
0
        protected override void AddNew()
        {
            this._SupplierProduct          = new Model.SupplierProduct();
            this._SupplierProduct.Supplier = this.bsSupplier.Current as Model.Supplier;
            if (this._SupplierProduct.Supplier != null)
            {
                this._SupplierProduct.SupplierId = this._SupplierProduct.Supplier.SupplierId;
            }
            this._SupplierProduct.SupplierProductPriceRange = "1/999999999999/0";

            this.action = "insert";
        }
        private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            this._CurrentSupplier = this.bsSupplier.Current as Model.Supplier;

            this._SupProList = this._SupplierProductManager.mSelect(this._CurrentSupplier.SupplierId);
            this.bsSupplierProduct.DataSource = _SupProList;
            if (this.bsSupplierProduct.Count > 0)
            {
                this._SupplierProduct = this.bsSupplierProduct.Current as Model.SupplierProduct;
            }
            this.grdConSupProduct.RefreshDataSource();
            this.Refresh();
        }
        //选择供应商改变
        private void bsSupplier_CurrentChanged(object sender, EventArgs e)
        {
            this._CurrentSupplier = this.bsSupplier.Current as Model.Supplier;

            this._SupProList = this._SupplierProductManager.mSelect(this._CurrentSupplier.SupplierId);
            this.bsSupplierProduct.DataSource = _SupProList;
            if (this.bsSupplierProduct.Count > 0)
            {
                this._SupplierProduct = this.bsSupplierProduct.Current as Model.SupplierProduct;
            }
            this.grdConSupProduct.RefreshDataSource();
            this.Refresh();
        }
Esempio n. 7
0
        //快速查询商品 供应商更改
        private void bsQuickSearch_CurrentChanged(object sender, EventArgs e)
        {
            this.bsPriceAndRange.DataSource = null;
            this.grdQuickSearchPriceRange.RefreshDataSource();
            DataRowView dr = this.bsQuickSearch.Current as DataRowView;

            this._SelectIsProduct = true;
            this._SupplierProduct = this._SupplierProductManager.Get(dr.Row["PrimiaryKey"].ToString());
            this.AnalyzePriceRange(this._SupplierProduct.SupplierProductPriceRange);

            this.bsPriceAndRange.DataSource = this._priceRangeList;
            this.grdQuickSearchPriceRange.RefreshDataSource();
        }
        protected override void AddNew()
        {
            this._SupplierProduct          = new Model.SupplierProduct();
            this._SupplierProduct.Supplier = this.bsSupplier.Current as Model.Supplier;
            if (this._SupplierProduct.Supplier != null)
            {
                this._SupplierProduct.SupplierId = this._SupplierProduct.Supplier.SupplierId;
            }
            this._SupplierProduct.SupplierProductPriceRange = "1/999999999999/0/0";
            this._SupplierProduct.BuildEmployee             = BL.V.ActiveOperator.Employee;

            this.action = "insert";
        }
        public override void Refresh()
        {
            if (this._SupplierProduct == null)
            {
                this.AddNew();
            }
            else
            {
                if (this.action == "view")
                {
                    this._SupplierProduct = this._SupplierProductManager.Get(this._SupplierProduct.SupplierProductId);
                }
                if (this._SupplierProduct == null)
                {
                    this.bsSupplierProduct.DataSource = this._SupplierProductManager.mSelect(this._CurrentSupplier.SupplierId);
                    if (this.bsSupplierProduct.Count == 0)
                    {
                        this.AddNew();
                    }
                    else
                    {
                        this._SupplierProduct           = this.bsSupplierProduct[0] as Model.SupplierProduct;
                        this.bsSupplierProduct.Position = 0;
                    }
                }
            }
            this.btnEditProcProduct.EditValue    = this._SupplierProduct.Product;
            this.memoEditNote.Text               = this._SupplierProduct.Note;
            this.nccBuildEmployee.EditValue      = this._SupplierProduct.BuildEmployee;
            this.nccChangeEmployee.EditValue     = this._SupplierProduct.ChangeEmployee;
            this.nccAtCurrencyCategory.EditValue = this._SupplierProduct.AtCurrencyCategory;
            this.AnalyzePriceRange(this._SupplierProduct.SupplierProductPriceRange);
            this.bsPriceAndRange.DataSource = this._priceRangeList;
            this.grdConSupProductPric.RefreshDataSource();

            this.date_Create.EditValue = this._SupplierProduct.InsertTime;
            this.date_Update.EditValue = this._SupplierProduct.UpdateTime;

            base.Refresh();

            this.btnEdit_SearchALLProduct.Enabled                       = true;
            this.btnEdit_SearchALLProduct.Properties.ReadOnly           = false;
            this.btnEdit_SearchALLProduct.Properties.Buttons[0].Visible = true;
        }
Esempio n. 10
0
        protected override void RefreshData()
        {
            //this.bindingSource1.DataSource = ((BL.ProductManager)this.manager).Query(" SELECT product.Id,ProductSpecification,ProductName,ProductCategoryName,SupplierFullName ,CustomerProductName,ProductDescription FROM Product left join ProductCategory ca  on ca.ProductCategoryId=Product.ProductCategoryId left join Supplier s on  s.SupplierId=Product.SupplierId  order by  ProductName", 240, "pro").Tables[0];
            //为了查询速度,暂将ProductSpecification,ProductDescription去掉
            this.bindingSource1.DataSource = this.dt = ((BL.ProductManager) this.manager).Query("SELECT p.ProductId,p.Id,p.ProductName,SupplierFullName ,CustomerProductName,ca.ProductCategoryName,isnull(StocksQuantity,0) StocksQuantity,ProductVersion,'' as Price  FROM Product p left join ProductCategory ca  on ca.ProductCategoryId=p.ProductCategoryId  left join Supplier s on  s.SupplierId=p.SupplierId order by  ProductName", 300, "pro").Tables[0];

            IList <Model.CustomerProductPrice> cppList = cpp.SelectAll();
            IList <Model.SupplierProduct>      sppList = spp.SelectAll();

            foreach (DataRow item in this.dt.Rows)
            {
                string productId  = item["ProductId"].ToString();
                string PriceRange = string.Empty;

                Model.CustomerProductPrice cPrice = cppList.FirstOrDefault(C => C.ProductId == productId);
                if (cPrice != null)
                {
                    PriceRange = cPrice.CustomerProductPriceRage;
                    cppList.Remove(cPrice);
                }
                else
                {
                    Model.SupplierProduct sPrice = sppList.FirstOrDefault(S => S.ProductId == productId);
                    if (sPrice != null)
                    {
                        PriceRange = sPrice.SupplierProductPriceRange;
                        sppList.Remove(sPrice);
                    }
                }
                string[] PriAndRange = string.IsNullOrEmpty(PriceRange) ? null : PriceRange.Split(',');

                if (PriAndRange != null)
                {
                    item["Price"] = (string.IsNullOrEmpty(PriAndRange[0].Split('/')[2]) ? null : PriAndRange[0].Split('/')[2]);
                }
            }
        }
Esempio n. 11
0
 public void Update(Model.SupplierProduct e)
 {
     this.Update <Model.SupplierProduct>(e);
 }
Esempio n. 12
0
 public Model.SupplierProduct GetNext(Model.SupplierProduct e)
 {
     return(accessor.GetNext(e));
 }
Esempio n. 13
0
 public Model.SupplierProduct GetPrev(Model.SupplierProduct e)
 {
     return(accessor.GetPrev(e));
 }
Esempio n. 14
0
 public bool HasRowsAfter(Model.SupplierProduct e)
 {
     return(accessor.HasRowsAfter(e));
 }
Esempio n. 15
0
 public bool HasRowsBefore(Model.SupplierProduct e)
 {
     return(accessor.HasRowsBefore(e));
 }
Esempio n. 16
0
 public Model.SupplierProduct GetPrev(Model.SupplierProduct e)
 {
     return(sqlmapper.QueryForObject <Model.SupplierProduct>("SupplierProduct.get_prev", e));
 }
Esempio n. 17
0
 public Model.SupplierProduct GetNext(Model.SupplierProduct e)
 {
     return(sqlmapper.QueryForObject <Model.SupplierProduct>("SupplierProduct.get_next", e));
 }
Esempio n. 18
0
 public bool HasRowsAfter(Model.SupplierProduct e)
 {
     return(sqlmapper.QueryForObject <bool>("SupplierProduct.has_rows_after", e));
 }
 //对照商品 行选择变化
 private void gridView4_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     this._SupplierProduct = this.bsSupplierProduct.Current as Model.SupplierProduct;
     this.action           = this._SupplierProduct == null ? "insert" : "view";
     this.Refresh();
 }
Esempio n. 20
0
 public void Insert(Model.SupplierProduct e)
 {
     this.Insert <Model.SupplierProduct>(e);
 }
Esempio n. 21
0
 public bool HasRowsBefore(Model.SupplierProduct e)
 {
     return(sqlmapper.QueryForObject <bool>("SupplierProduct.has_rows_before", e));
 }
Esempio n. 22
0
        protected override void RefreshData()
        {
            //为了查询速度,暂将ProductSpecification,ProductDescription去掉
            this.bindingSource1.DataSource = this.dt = ((BL.ProductManager) this.manager).Query("SELECT product.ProductId,product.Id,ProductName,ProductCategoryName,c.CustomerFullName ,CustomerProductName,isnull(StocksQuantity,0) StocksQuantity,ProductVersion,'' as Price FROM Product left join ProductCategory ca  on ca.ProductCategoryId=Product.ProductCategoryId left join Customer c on c.CustomerId=Product.CustomerId order by  ProductName", 300, "pro").Tables[0];

            IList <Model.CustomerProductPrice> cppList = cpp.SelectAll();
            IList <Model.SupplierProduct>      sppList = spp.SelectAll();

            #region 方案一
            foreach (DataRow item in this.dt.Rows)
            {
                string productId  = item["ProductId"].ToString();
                string PriceRange = string.Empty;

                Model.CustomerProductPrice cPrice = cppList.FirstOrDefault(C => C.ProductId == productId);
                if (cPrice != null)
                {
                    PriceRange = cPrice.CustomerProductPriceRage;
                    cppList.Remove(cPrice);
                }
                else
                {
                    Model.SupplierProduct sPrice = sppList.FirstOrDefault(S => S.ProductId == productId);
                    if (sPrice != null)
                    {
                        PriceRange = sPrice.SupplierProductPriceRange;
                        sppList.Remove(sPrice);
                    }
                }
                string[] PriAndRange = string.IsNullOrEmpty(PriceRange) ? null : PriceRange.Split(',');

                if (PriAndRange != null)
                {
                    item["Price"] = (string.IsNullOrEmpty(PriAndRange[0].Split('/')[2]) ? null : PriAndRange[0].Split('/')[2]);
                }
            }
            #endregion

            #region 方案二 更慢
            //EnumerableRowCollection<DataRow> dtListAll = dt.AsEnumerable();
            //EnumerableRowCollection<DataRow> dtListCustomer = dtListAll.Where(D => cppList.Any(C => C.ProductId == D.Field<string>("ProductId")));
            //EnumerableRowCollection<DataRow> dtListSuppiler = dtListAll.Where(D => sppList.Any(C => C.ProductId == D.Field<string>("ProductId")));
            //foreach (DataRow item in dtListCustomer)
            //{
            //    string productId = item["ProductId"].ToString();
            //    string PriceRange = string.Empty;

            //    Model.CustomerProductPrice cPrice = cppList.First(C => C.ProductId == productId);
            //    PriceRange = cPrice.CustomerProductPriceRage;
            //    cppList.Remove(cPrice);

            //    string[] PriAndRange = string.IsNullOrEmpty(PriceRange) ? null : PriceRange.Split(',');

            //    if (PriAndRange != null)
            //    {
            //        item["Price"] = (string.IsNullOrEmpty(PriAndRange[0].Split('/')[2]) ? null : PriAndRange[0].Split('/')[2]);
            //    }
            //}
            //foreach (DataRow item in dtListSuppiler)
            //{
            //    string productId = item["ProductId"].ToString();
            //    string PriceRange = string.Empty;

            //    Model.SupplierProduct sPrice = sppList.First(S => S.ProductId == productId);
            //    PriceRange = sPrice.SupplierProductPriceRange;
            //    sppList.Remove(sPrice);

            //    string[] PriAndRange = string.IsNullOrEmpty(PriceRange) ? null : PriceRange.Split(',');

            //    if (PriAndRange != null)
            //    {
            //        item["Price"] = (string.IsNullOrEmpty(PriAndRange[0].Split('/')[2]) ? null : PriAndRange[0].Split('/')[2]);
            //    }
            //}
            #endregion
        }