Beispiel #1
0
        public Product RecordProduct(String productId)
        {
            try
            {
                DataTable dt;
                dt = new DataTable();
                dt = this.db.execQuery("Sp_ProductSelById", new object[] { productId });
                Model.Product prod = new Model.Product();
                if (dt.Rows.Count > 0)
                {
                    prod.product_id = dt.Rows[0]["product_id"].ToString();
                    prod.uom_code = dt.Rows[0]["uom_code"].ToString();
                    prod.product_name = dt.Rows[0]["product_name"].ToString();
                    //System.Console.Write(dt.Rows[0]["qtt_stock"].ToString());
                    prod.qty_stock = Convert.ToInt32(dt.Rows[0]["qty_stock"].ToString());
                    prod.product_price = Convert.ToInt32(dt.Rows[0]["product_price"].ToString());
                }

                return prod;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public IEnumerable<Model.Product> GetProductsByCategoryID(string categoryID)
        {
            string sql = "";

            string connectionString = DBHelper.ConnectionString;

            SqlParameter pID = new SqlParameter("@id", SqlDbType.VarChar, 10);
            pID.Value = categoryID;

            List<Petshop.Model.Product> list = new List<Model.Product>();

            using (SqlDataReader reader=DBUtility.SqlHelper.ExecuteReader(connectionString,CommandType.Text,sql,pID))
            {
                while (reader.Read())
                {
                    Model.Product product = new Model.Product()
                    {
                        //为相应属性赋值
                    };
                    list.Add(product);
                }
                reader.Close();
            }
            return list;
        }
Beispiel #3
0
 private void ShowPnl(PnlToShow pnlToshow, Model.Product product = null)
 {
     if (pnlToshow == PnlToShow.pnlProduct)
     {
         //this.pnlProperty.Width = 0;
         pnlProperty.Hide();
         pnlProduct.Show();
     }
     if (pnlToshow == PnlToShow.pnlProperty)
     {
         pnlProperty.Width    = pnlProduct.Width;
         pnlProperty.Location = new Point(pnlProduct.Location.X, pnlProperty.Location.Y);
         pnlProduct.Hide();
         frmSelectProperty = new frmSelecteProperties(product, m_Company);
         frmSelectProperty.SaveSelectedProperty = SaveSelectedProperty;
         frmSelectProperty.HideThis             = HideProperty;
         //frmSelectProperty.m_Product = product;
         pnlProperty.Controls.Clear();
         pnlProperty.Controls.Add(frmSelectProperty);
         pnlProperty.Show();
     }
 }
Beispiel #4
0
 private void btn_Product_EditValueChanged(object sender, EventArgs e)
 {
     Model.Product p = this.btn_Product.EditValue as Model.Product;
     if (p != null)
     {
         if (!string.IsNullOrEmpty(p.BasedUnitGroupId))
         {
             BL.ProductUnitManager     manager  = new Book.BL.ProductUnitManager();
             Model.UnitGroup           ug       = new BL.UnitGroupManager().Get(p.BasedUnitGroupId);
             IList <Model.ProductUnit> unitList = manager.Select(ug);
             this.cobUnit.Properties.Items.Clear();
             foreach (Model.ProductUnit item in unitList)
             {
                 this.cobUnit.Properties.Items.Add(item.CnName);
             }
         }
     }
     else
     {
         this.cobUnit.Properties.Items.Clear();
     }
 }
Beispiel #5
0
        private void gridView3_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.InvoiceCGDetail> details = this.bindingSource1.DataSource as IList <Model.InvoiceCGDetail>;

            if (details == null || details.Count < 1)
            {
                return;
            }
            Model.Product         detail   = details[e.ListSourceRowIndex].Product;
            Model.InvoiceCODetail codetail = details[e.ListSourceRowIndex].InvoiceCODetail;
            switch (e.Column.Name)
            {
            case "colProductId":
                if (detail == null)
                {
                    return;
                }
                e.DisplayText = detail.Id;
                break;

            case "gridColumn18":
                if (codetail != null)
                {
                    e.DisplayText = codetail.NoArrivalQuantity.Value.ToString("0.####");
                }
                break;

            case "gridColumn17":
                if (codetail != null)
                {
                    e.DisplayText = codetail.OrderQuantity.Value.ToString();
                }
                break;
            }
        }
Beispiel #6
0
        private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            Model.Product p = null;

            if (this.action != "view")
            {
                IList <Model.InvoicePODetail> invoicePODetails = this.bindingSourcePODetail.DataSource as IList <Model.InvoicePODetail>;

                if (invoicePODetails == null || invoicePODetails.Count <= 0)
                {
                    return;
                }
                p = invoicePODetails[e.ListSourceRowIndex].Product;
            }
            else
            {
                IList <Model.InvoicePIDetail> invoicePIDetails = this.bindingSourcePODetail.DataSource as IList <Model.InvoicePIDetail>;
                if (invoicePIDetails == null || invoicePIDetails.Count <= 0)
                {
                    return;
                }
                p = invoicePIDetails[e.ListSourceRowIndex].Product;
            }

            switch (e.Column.Name)
            {
            case "gridColumn5":
                e.DisplayText = p.ProductSpecification;
                break;

            case "gridColumn10":
                e.DisplayText = p.CustomerProductName;
                break;
            }
        }
Beispiel #7
0
        public async Task <IActionResult> Update(int id, Model.Product productData)
        {
            var product = _context.Products.Where(a => a.Id == id).FirstOrDefault();

            if (product == null)
            {
                return(NotFound());
            }
            else
            {
                product.Name            = productData.Name;
                product.Description     = productData.Description;
                product.Price           = productData.Price;
                product.Rating          = productData.Rating;
                product.Stock_Available = productData.Stock_Available;
                product.Url             = productData.Url;

                await _context.SaveChanges();

                return(Ok(product.Id));
            }
        }
Beispiel #8
0
 private void gridViewIn_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     if (e.Column == this.colProductId)
     {
         Model.InvoiceCFDetail detailIn = this.gridViewIn.GetRow(e.RowHandle) as Model.InvoiceCFDetail;
         if (detailIn != null)
         {
             Model.Product p = productManager.Get(e.Value.ToString());
             detailIn.InvoiceCFDetailId       = Guid.NewGuid().ToString();
             detailIn.InvoiceCFDetailKind     = "I";
             detailIn.InvoiceCFDetailNote     = "";
             detailIn.InvoiceCFDetailPrice    = 0;
             detailIn.InvoiceCFDetailQuantity = 0;
             detailIn.InvoiceCFDetailZongji   = 0;
             detailIn.Product   = p;
             detailIn.ProductId = p.ProductId;
             //detailIn.InvoiceProductUnit = detailIn.Product.ProductBaseUnit;
             this.bindingSourceIn.Position = this.bindingSourceIn.IndexOf(detailIn);
         }
         this.gridControlIn.RefreshDataSource();
     }
 }
Beispiel #9
0
        public void Insert(IList <Model.Stock> list)
        {
            foreach (Model.Stock item in list)
            {
                Model.Stock stock = this.GetStockByProductIdAndDepotPositionId(item.ProductId, item.DepotPositionId);
                if (stock != null)
                {
                    if (stock.IsNotUpdate != null)
                    {
                        if (!stock.IsNotUpdate.Value)
                        {
                            stock.StockQuantity0 = item.StockQuantity0;
                        }
                        else
                        {
                            stock.StockQuantity0 = item.StockQuantity0;
                            stock.StockQuantity1 = item.StockQuantity0;
                        }
                    }
                    else
                    {
                        stock.StockQuantity0 = item.StockQuantity0;
                        stock.StockQuantity1 = item.StockQuantity0;
                    }

                    this.Update(stock);
                    Model.Product pro = productAccessor.Get(item.ProductId);
                    // pro.StocksQuantity = this.GetTheCountByProduct(item.Product);
                    productManager.UpdateProduct_Stock(pro);
                }
                else
                {
                    this.Insert(item);
                    Model.Product pro = productAccessor.Get(item.ProductId);
                    // pro.StocksQuantity = this.GetTheCountByProduct(item.Product);
                    productManager.UpdateProduct_Stock(pro);
                }
            }
        }
Beispiel #10
0
        private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
        {
            if (this.gridView1.FocusedColumn.Name == this.gridColumn1.Name)
            {
                if (this.gridView1.FocusedColumn.ColumnEdit is DevExpress.XtraEditors.Repository.RepositoryItemComboBox)
                {
                    Model.Product p = (this.gridView1.GetRow(this.gridView1.FocusedRowHandle) as Model.CustomerPackageDetail).Product;

                    this.repositoryItemComboBox1.Items.Clear();

                    if (!string.IsNullOrEmpty(p.BasedUnitGroupId))
                    {
                        IList <Model.ProductUnit> units = productUnitManager.Select(p.BasedUnitGroup);

                        foreach (Model.ProductUnit ut in units)
                        {
                            this.repositoryItemComboBox1.Items.Add(ut.CnName);
                        }
                    }
                }
            }
        }
Beispiel #11
0
        public bool Save(Model.Product product)
        {
            if (!product.HasChanges)
            {
                return(true);
            }

            if (!product.IsValid)
            {
                return(false);
            }
            if (product.IsNew)
            {
                //Insert
            }
            else
            {
                //Update
            }

            return(true);
        }
Beispiel #12
0
        private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
        {
            if (this.gridView1.FocusedColumn.Name == "gridColumn1")
            {
                if (this.gridView1.FocusedColumn.ColumnEdit is DevExpress.XtraEditors.Repository.RepositoryItemComboBox)
                {
                    Model.Product p = (this.gridView1.GetRow(this.gridView1.FocusedRowHandle) as Model.InvoiceCTDetail).Product;

                    this.repositoryItemComboBox1.Items.Clear();

                    if (!string.IsNullOrEmpty(p.BasedUnitGroupId))
                    {
                        BL.ProductUnitManager     unitManager = new Book.BL.ProductUnitManager();
                        IList <Model.ProductUnit> unitList    = unitManager.Select(p.BasedUnitGroupId);
                        foreach (Model.ProductUnit item in unitList)
                        {
                            this.repositoryItemComboBox1.Items.Add(item.CnName);
                        }
                    }
                }
            }
        }
Beispiel #13
0
 private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
 {
     if (this.gridView1.FocusedColumn.Name == "gridColumnProductUnitName")
     {
         if (this.gridView1.FocusedColumn.ColumnEdit is DevExpress.XtraEditors.Repository.RepositoryItemComboBox)
         {
             Model.Product p = (this.gridView1.GetRow(this.gridView1.FocusedRowHandle) as Model.StockEditorDetal).Product;
             if (p == null)
             {
                 return;
             }
             if (!string.IsNullOrEmpty(p.BasedUnitGroupId))
             {
                 IList <Model.ProductUnit> units = this._productUnitManager.Select(p.BasedUnitGroupId);
                 foreach (Model.ProductUnit ut in units)
                 {
                     this.repositoryItemComboBox1.Items.Add(ut.CnName);
                 }
             }
         }
     }
 }
Beispiel #14
0
        /// <summary>
        /// 选择货品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonEditProduct_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            Invoices.ChooseProductForm f = new Book.UI.Invoices.ChooseProductForm();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.Product product = f.SelectedItem as Model.Product;
                if (product != null)
                {
                    this.buttonEditProduct.Text   = product.Id;
                    this.textEditProductName.Text = string.IsNullOrEmpty(product.CustomerProductName) ? product.ProductName : product.ProductName + "{" + product.CustomerProductName + "}";

                    if (!string.IsNullOrEmpty(product.CustomerProductName))
                    {
                        this.textEditCustomerPro.Text = product.CustomerProductName;
                    }

                    if (product.IsCustomerProduct == true && !string.IsNullOrEmpty(product.CustomerProductName))
                    {
                        this._bomParentPartInfo = bomParentPartInfo.Get(this.productManager.Get(product.CustomerBeforeProductId));
                        // this.textEditCustomProduct.Text = product.CustomerProductName;
                        this.newChooseContorlCustomer.EditValue = product.Customer;
                    }
                    else
                    {
                        this._bomParentPartInfo = bomParentPartInfo.Get(product);
                        // this.textEditCustomProduct.Text = "";
                        this.newChooseContorlCustomer.EditValue = null;
                    }
                    this._manprocedure.Bom = this._bomParentPartInfo;
                    if (this._bomParentPartInfo != null)
                    {
                        this.textEditBOMID.EditValue = this._bomParentPartInfo.Id;
                        // this.textEditBOMType.EditValue = this._bomParentPartInfo.MaterialType;
                    }
                }
            }
            f.Dispose();
            GC.Collect();
        }
Beispiel #15
0
 private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     if (e.Column == this.gridColumn1 || e.Column == this.gridColumn2)
     {
         Model.StockCheckDetail detail = this.gridView1.GetRow(e.RowHandle) as Model.StockCheckDetail;
         if (detail != null)
         {
             Model.Product p = productManager.Get(e.Value.ToString());
             detail.StockCheckDetailId = Guid.NewGuid().ToString();
             detail.StockCheckId       = _stockCheck.StockCheckId;
             detail.StockCheck         = _stockCheck;
             detail.Directions         = "";
             detail.StockCheckQuantity = null;
             detail.Product            = p;
             detail.Directions         = p.ProductDescription;
             detail.ProductId          = p.ProductId;
             detail.ProductUnitName    = p.DepotUnit == null ? null : p.DepotUnit.CnName;
             this.bindingSourceStockCheckDetail.Position = this.bindingSourceStockCheckDetail.IndexOf(detail);
         }
         this.gridControl1.RefreshDataSource();
     }
 }
        void updateItems()
        {
            if (Program.theDatabase.currentSale.productIDs == null)
            {
                return;
            }
            foreach (StringTexture t in items)
            {
                t.Dispose();
            }
            items.Clear();

            for (int i = 0; i < Program.theDatabase.currentSale.productIDs.Length; i++)
            {
                Model.Product p = Program.theDatabase.getProduct(Program.theDatabase.currentSale.productIDs[i]);
                string        s = p.cost.ToString("c");
                s = s + " - " + p.name;

                items.Add(GLMethods.generateString(s, 16, System.Drawing.Color.White));
            }

            foreach (Button b in cancelButtons)
            {
                b.Dispose();
            }
            cancelButtons.Clear();

            for (int i = 0; i < Program.theDatabase.currentSale.productIDs.Length; i++)
            {
                Model.Product p = Program.theDatabase.getProduct(Program.theDatabase.currentSale.productIDs[i]);
                cancelButtons.Add(new Button("x", 16, System.Drawing.Color.Red, System.Drawing.Color.Red, 0, 0));
                cancelButtons[i].onClick2 += cancelClicked;
            }
            cancelButtons.Add(new Button("X", 16, System.Drawing.Color.Red, System.Drawing.Color.Red, 0, 0));
            cancelButtons[cancelButtons.Count - 1].onClick2 += cancelClicked;

            Program.theDatabase.saveToDisk();
        }
Beispiel #17
0
        private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            Model.InvoiceHZDetail detail = this.gridView1.GetRow(e.RowHandle) as Model.InvoiceHZDetail;
            if (e.Column == this.colProductId)
            {
                if (detail != null)
                {
                    Model.Product p = productManager.Get(e.Value.ToString());
                    detail.InvoiceHZDetailId       = Guid.NewGuid().ToString();
                    detail.InvoiceHZDetailMoney    = 0;
                    detail.InvoiceHZDetailNote     = "";
                    detail.InvoiceHZDetailPrice    = 0;
                    detail.InvoiceHZDetailQuantity = 0;
                    detail.Product   = p;
                    detail.ProductId = p.ProductId;
                    //detail.InvoiceCGDetailPrice = detail.Product.ProductCurrentCGPrice == null ? 0 : detail.Product.ProductCurrentCGPrice.Value;
                    //detail.InvoiceProductUnit = detail.Product.ProductBaseUnit;
                    //detail.InvoiceCGDetailMoney0 = Convert.ToDecimal(detail.InvoiceCGDetailQuantity.Value) * detail.InvoiceCGDetailPrice;
                    //detail.InvoiceCGDetailMoney1 = detail.InvoiceCGDetailMoney0;
                    this.bindingSourceInvoiceHZDetail.Position = this.bindingSourceInvoiceHZDetail.IndexOf(detail);
                }
                this.gridControl1.RefreshDataSource();
            }
            if (e.Column == this.DepotPositionId)
            {
                if (detail != null)
                {
                    Model.DepotPosition position = new BL.DepotPositionManager().Get(e.Value.ToString());
                    detail.DepotPosition = position;

                    if (position != null)
                    {
                        detail.DepotPositionId = position.DepotPositionId;
                    }
                }
                this.gridControl1.RefreshDataSource();
            }
        }
        public IList <Model.ProduceMaterialdetails> SelectByProductIdAndHeadId(Model.Product pId0, Model.Product pId1, string produceMaterialId)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("SELECT * ");
            sb.Append(" ,(SELECT ProductName FROM Product WHERE Product.ProductId = ProduceMaterialdetails.ProductId) AS ProductName");
            sb.Append(" ,(SELECT CustomerProductName FROM Product WHERE Product.ProductId = ProduceMaterialdetails.ProductId) AS CustomerProductName");
            sb.Append(" FROM ProduceMaterialdetails WHERE ProduceMaterialID='" + produceMaterialId + "'");
            if (pId0 != null && pId1 != null)
            {
                sb.Append(" AND ProductId IN (SELECT ProductId FROM Product WHERE Id BETWEEN '" + pId0.Id + "' AND '" + pId1.Id + "')");
            }

            return(this.DataReaderBind <Model.ProduceMaterialdetails>(sb.ToString(), null, CommandType.Text));

            #region 注释
            //Hashtable ht = new Hashtable();
            //ht.Add("produceMaterialId", produceMaterialId);
            //ht.Add("pId0", pId0 == null ? null : pId0.ProductName);
            //ht.Add("pId1", pId1 == null ? null : pId1.ProductName);
            //return sqlmapper.QueryForList<Model.ProduceMaterialdetails>("ProduceMaterialdetails.selectByproductIdAndHeadIdRange", ht);
            #endregion
        }
        private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.ProduceMaterialdetails> list = this.bindingSourceProduceMaterialDetails.DataSource as IList <Model.ProduceMaterialdetails>;

            if (list == null || list.Count == 0)
            {
                return;
            }
            Model.Product product = list[e.ListSourceRowIndex].Product;
            switch (e.Column.Name)
            {
            case "gridColumnProductId":
                if (product != null)
                {
                    e.DisplayText = product.Id;
                }
                break;
            }
        }
Beispiel #20
0
        private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            Model.ProduceOtherExitDetail detail = this.gridView1.GetRow(e.RowHandle) as Model.ProduceOtherExitDetail;

            if (e.Column == this.ColProductId)
            {
                if (detail != null)
                {
                    Model.Product p = productManager.Get(e.Value.ToString());
                    detail.ProduceOtherExitDetailId = Guid.NewGuid().ToString();
                    detail.ProduceQuantity          = 0;
                    detail.ProduceAllUserQuantity   = 0;
                    detail.CriterionUserQuantity    = 0;
                    detail.Product              = p;
                    detail.ProductId            = p.ProductId;
                    detail.ProductStock         = p.StocksQuantity;
                    detail.ProductSpecification = p.ProductSpecification;

                    this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
                }
                this.gridControl1.RefreshDataSource();
            }
        }
Beispiel #21
0
 private void Validate(Model.Product product)
 {
     if (product.ProductCategory == null)
     {
         throw new Helper.RequireValueException(Model.Product.PRO_ProductCategoryId);
     }
     if (string.IsNullOrEmpty(product.Id))
     {
         throw new Helper.RequireValueException(Model.Product.PRO_Id);
     }
     if (string.IsNullOrEmpty(product.ProductName))
     {
         throw new Helper.RequireValueException(Model.Product.PRO_ProductName);
     }
     if (product.BasedUnitGroup == null)
     {
         throw new Helper.RequireValueException(Model.Product.PRO_BasedUnitGroupId);
     }
     if (product.DepotUnit == null)
     {
         throw new Helper.RequireValueException(Model.Product.PRO_DepotUnitId);
     }
 }
Beispiel #22
0
 private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     if (e.Column == this.gridColumn3 || e.Column == this.gridColumnProductId || e.Column == this.gridColumnProductName)
     {
         Model.DepotInDetail detail = this.gridView1.GetRow(e.RowHandle) as Model.DepotInDetail;
         if (detail != null)
         {
             Model.Product p = this._productManager.Get(e.Value.ToString());
             //detail.DepotInDetailId = Guid.NewGuid().ToString();
             detail.DepotPositionId            = null;
             detail.DepotInQuantity            = 1;
             detail.DepotInPrice               = null;
             detail.DepotInTotal               = null;
             detail.Product                    = p;
             detail.ProductId                  = p == null ? "" : p.ProductId;
             detail.ProductUnit                = p == null ? "" : p.DepotUnit.CnName;
             detail.DepotInId                  = this._depotIn.DepotInId;
             detail.Description                = p == null ? "" : p.ProductDescription;
             this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);
         }
         this.gridControl1.RefreshDataSource();
     }
 }
Beispiel #23
0
        private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            Model.InvoicePODetail detail = this.gridView1.GetRow(e.RowHandle) as Model.InvoicePODetail;
            if (e.Column == this.colProductId)
            {
                if (detail != null)
                {
                    Model.Product p = productManager.Get(e.Value.ToString());
                    detail.InvoicePODetailId         = Guid.NewGuid().ToString();
                    detail.InvoicePIDetailNote       = "";
                    detail.InvoicePIDetailQuantity   = 0;
                    detail.InvoicePODetailNote       = "";
                    detail.InvoicePODetailJCQuantity = 0;
                    detail.InvoicePODetailWHQuantity = 0;
                    detail.InvoicePODetailYHQuantity = 0;
                    detail.Product               = p;
                    detail.ProductId             = p.ProductId;
                    detail.InvoiceProductUnit    = detail.Product.ProduceUnit.CnName;;
                    this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
                }
                this.gridControl1.RefreshDataSource();
            }
            if (e.Column == this.gridColumn1)
            {
                if (detail != null)
                {
                    Model.DepotPosition position = new BL.DepotPositionManager().Get(e.Value.ToString());
                    detail.DepotPosition = position;

                    if (position != null)
                    {
                        detail.DepotPositionId = position.DepotPositionId;
                    }
                }
                this.gridControl1.RefreshDataSource();
            }
        }
        private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.ProduceMaterialExitDetail> list = this.bindingSourceProduceMaterialDetails.DataSource as IList <Model.ProduceMaterialExitDetail>;

            if (list == null || list.Count == 0)
            {
                return;
            }
            //Model.Depot depot = list[e.ListSourceRowIndex].Depot;
            //string depotPosition = list[e.ListSourceRowIndex].DepotPosition;
            Model.Product product = list[e.ListSourceRowIndex].Product;
            //string productUnit = list[e.ListSourceRowIndex].ProductUnit;
            switch (e.Column.Name)
            {
            //case "gridColumnDepotId":
            //    if (depot != null)
            //        e.DisplayText = string.IsNullOrEmpty(depot.DepotId) ? "" : depot.ToString();
            //    break;
            case "gridColumnProductId":
                if (product != null)
                {
                    e.DisplayText = string.IsNullOrEmpty(product.ProductId) ? "" : product.ToString();
                }
                break;

            case "gridColumnProductName":
                if (product != null)
                {
                    e.DisplayText = string.IsNullOrEmpty(product.ProductId) ? "" : product.Id;
                }
                break;
            }
        }
        public void Delete(Model.ProduceOtherMaterial produceOtherMaterial)
        {
            try
            {
                BL.V.BeginTransaction();

                //foreach (var item in ProduceOtherMaterialDetailAccessor.Select(produceOtherMaterial))
                //{
                //    stockAccessor.Increment(new BL.DepotPositionManager().Get(item.DepotPositionId), item.Product, item.OtherMaterialQuantity);

                //    Model.ProduceOtherCompactMaterial CompactDetail = produceOtherCompactMaterialAccessor.Get(item.ProduceOtherCompactMaterialId);
                //    if (CompactDetail != null)
                //    {
                //        CompactDetail.AlreadyOutQuantity = CompactDetail.AlreadyOutQuantity == null ? 0 : CompactDetail.AlreadyOutQuantity - item.OtherMaterialQuantity;
                //        produceOtherCompactMaterialAccessor.Update(CompactDetail);
                //    }
                //}
                Model.ProduceOtherMaterial produceMaterialOld = this.GetDetails(produceOtherMaterial.ProduceOtherMaterialId);
                foreach (Model.ProduceOtherMaterialDetail detail in produceMaterialOld.Details)
                {
                    //  produceMaterialdetails.Distributioned = (produceMaterialdetails.Distributioned == null ? 0 : produceMaterialdetails.Distributioned) + produceMaterialdetails.Materialprocessum;

                    Model.Product product = productManager.Get(detail.Product.ProductId);
                    product.OtherMaterialDistributioned = (product.OtherMaterialDistributioned == null ? 0 : product.OtherMaterialDistributioned) - (detail.OtherMaterialQuantity == null ? 0 : detail.OtherMaterialQuantity) + (detail.OtherMaterialALLUserQuantity == null ? 0 : detail.OtherMaterialALLUserQuantity);
                    productManager.update(product);
                }
                this.Delete(produceOtherMaterial.ProduceOtherMaterialId);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Beispiel #26
0
        private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.ProduceOtherCompactMaterial> details = this.bindingSourceMaterial.DataSource as IList <Model.ProduceOtherCompactMaterial>;

            if (details == null || details.Count < 1)
            {
                return;
            }
            Model.Product detail = details[e.ListSourceRowIndex].Product;
            switch (e.Column.Name)
            {
            case "gridColumnStock1":
                if (detail == null)
                {
                    return;
                }
                e.DisplayText = detail.StocksQuantity.HasValue ? detail.StocksQuantity.ToString() : "0";
                break;
            }
        }
Beispiel #27
0
 private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     if (e.Column == this.colProductId)
     {
         Model.InvoiceJRDetail detail = this.gridView1.GetRow(e.RowHandle) as Model.InvoiceJRDetail;
         if (detail != null)
         {
             Model.Product p = productManager.Get(e.Value.ToString());
             detail.InvoiceJRDetailId         = Guid.NewGuid().ToString();
             detail.InvoiceHCDetailNote       = "";
             detail.InvoiceHCDetailQuantity   = 0;
             detail.InvoiceJRDetailNote       = "";
             detail.InvoiceJRDetailQuantity   = 0;
             detail.InvoiceWeiHuaiChuQuantity = 0;
             detail.InvoiceYiHuaiChuQuantity  = 0;
             detail.Product            = p;
             detail.ProductId          = p.ProductId;
             detail.InvoiceProductUnit = p.ProduceUnit.CnName;
             //detail.InvoiceProductUnit = detail.Product.ProductBaseUnit;
             this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
         }
         this.gridControl1.RefreshDataSource();
     }
 }
Beispiel #28
0
        private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.Stock> stockDetail = this.bindingSourceStock.DataSource as IList <Model.Stock>;

            if (stockDetail == null || stockDetail.Count < 1)
            {
                return;
            }
            Model.Product product = stockDetail[e.ListSourceRowIndex].Product;
            if (product == null)
            {
                return;
            }
            switch (e.Column.Name)
            {
            case "gridColumnProductUnit":
                e.DisplayText = product.DepotUnit == null ? string.Empty : product.DepotUnit.CnName;
                break;

            case "gridColumnProductSpecification":
                e.DisplayText = product.ProductSpecification;
                break;

            case "gridColumnProductId":
                e.DisplayText = product.Id;
                break;

            case "gridColumn":
                e.DisplayText = product.ProductDescription;
                break;
            }
        }
Beispiel #29
0
        private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.ProduceMaterialExitDetail> details = this.bindingSourceproduceMaterialExitDetail.DataSource as IList <Model.ProduceMaterialExitDetail>;

            if (details == null || details.Count < 1)
            {
                return;
            }
            Model.Product p = details[e.ListSourceRowIndex].Product;
            switch (e.Column.Name)
            {
            case "gridColumnproductId":
                e.DisplayText = p.Id;
                break;

            case "gridColumnStock":
                e.DisplayText = p.StocksQuantity.ToString();
                break;
            }
        }
 public void ConvertToBusinessObject(out OnlineShoppingCart.Model.Product productBO)
 {
     productBO = new Model.Product
     {
         ID = this.Id,
         ProductCode = this.ProductCode,
         ProductName = this.ProductName,
         ProductDescription = this.ProductDescription,
         CategoryID = this.CategoryId,
         Brand = this.Brand,
         Model = this.Model,
         UnitPrice = this.UnitPrice,
         SKU = this.SKU,
         CurrentStock = this.CurrentStock,
         IsActive = this.IsActive,
         CreatedOn = this.CreatedOn,
         UpdatedOn = this.UpdatedOn.GetValueOrDefault(),
         CreatedByUserID = this.CreatedByUserId,
         UpdatedByUserID = this.UpdatedByUserId.GetValueOrDefault()
         //public byte[] ImageThumbNail =
         //byte[] ImageIndex =
         //List<byte[]> ImageOthers =
     };
 }
Beispiel #31
0
        //删除图片
        public string DelPic(HttpContext context)
        {
            try
            {
                DataSet ds = new DataSet();
                long    ID = Convert.ToInt64(context.Request["lbID"]);
                ds = new BLL.Product().GetDataSetByProc(ID);

                string path = System.Web.HttpContext.Current.Server.MapPath("../ProductPic/" + ds.Tables[0].Rows[0]["Image"].ToString() + "");
                if (System.IO.File.Exists(path))
                {
                    string delFile = System.Web.HttpContext.Current.Server.MapPath("../ProductPic/" + ds.Tables[0].Rows[0]["Image"].ToString() + "");
                    System.IO.File.Delete(delFile);
                }

                Model.Product model = new Model.Product();
                model.ID    = ID;
                model.Image = "";

                ds = new BLL.Product().UpdateImageByProc(model);


                if (ds.Tables[0].Rows[0][0].ToString() == "")
                {
                    return("success");
                }
                else
                {
                    return("fail");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #32
0
        private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            detailsDisplay = this.bindingSource1.DataSource as IList <Model.InvoiceXTDetail>;
            if (detailsDisplay == null || detailsDisplay.Count < 1)
            {
                return;
            }
            //Model.CustomerProducts detail = details[e.ListSourceRowIndex].PrimaryKey;
            detailDisplay = detailsDisplay[e.ListSourceRowIndex].Product;
            //Model.InvoiceXODetail xodetail = invoicexoDetailManager.Get(detailsDisplay[e.ListSourceRowIndex].InvoiceXODetailId);
            if (detailDisplay == null)
            {
                return;
            }
            switch (e.Column.Name)
            {
            case "colProductId":
                e.DisplayText = detailDisplay.Id;
                break;

            case "gridColumCusProName":
                e.DisplayText = detailDisplay.CustomerProductName;
                break;

            case "gridColumnCuxXOId":
                if (detailsDisplay[e.ListSourceRowIndex].InvoiceXODetail != null)
                {
                    e.DisplayText = detailsDisplay[e.ListSourceRowIndex].InvoiceXODetail.Invoice.CustomerInvoiceXOId;
                }
                break;
            }
        }
Beispiel #33
0
        private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.ListSourceRowIndex < 0)
            {
                return;
            }
            IList <Model.InvoiceCJDetail> details = this.bindingSource1.DataSource as IList <Model.InvoiceCJDetail>;

            if (details == null || details.Count < 1)
            {
                return;
            }
            Model.Product detail = details[e.ListSourceRowIndex].Product;
            switch (e.Column.Name)
            {
            case "colProductId":
                if (detail == null)
                {
                    return;
                }
                e.DisplayText = string.IsNullOrEmpty(detail.Id) ? "" : detail.Id;
                break;
            }
        }
Beispiel #34
0
        private static void LoadMySQLEntries()
        {
            using (ProductsDBContext sqlContext = new ProductsDBContext())
            {
                ProductsDBModel mySQLContext = new ProductsDBModel(@"Server=localhost;Database=products_db;Uid=Rami;Pwd=killer91;");
                foreach (var measure in mySQLContext.Measures)
                {
                    ProductsDB.Model.Measure newMeasure = new Model.Measure()
                    {
                        MeasureId = measure.Measure_ID,
                        MeasureName = measure.Measure_Name
                    };

                    sqlContext.Measures.Add(newMeasure);
                }

                sqlContext.SaveChanges();

                foreach (var vendor in mySQLContext.Vendors)
                {
                    ProductsDB.Model.Vendor newVendor = new Model.Vendor()
                    {
                        VendorId = vendor.Vendor_ID,
                        VendorName = vendor.Vendor_Name
                    };

                    sqlContext.Vendors.Add(newVendor);
                }

                sqlContext.SaveChanges();

                foreach (var prod in mySQLContext.Products)
                {
                    ProductsDB.Model.Vendor vendor = sqlContext.Vendors.Where
                        (v => v.VendorId == prod.Vendors_Vendor_ID).First();
                    ProductsDB.Model.Measure measure = sqlContext.Measures.Where
                        (m => m.MeasureId == prod.Measures_Measure_ID).First();
                    ProductsDB.Model.Product newProd = new Model.Product()
                    {
                        ProductId = prod.Products_ID,
                        ProductName = prod.Product_Name,
                        VendorId = prod.Vendors_Vendor_ID,
                        Vendor = vendor,
                        MeasureId = prod.Measures_Measure_ID,
                        Measure = measure,
                        BasePrice = prod.BasePrice,
                    };

                    sqlContext.Products.Add(newProd);
                }

                sqlContext.SaveChanges();
            }
        }
        public ActionResult post_product(HttpPostedFileBase fileData)
        {
            HttpFileCollectionBase files = Request.Files;
            fileData = files["file"];
            string title, bewrite, select_option_type, file_img, price, number, date, pointOfDeparture = "";
            select_option_type = Library_public.Tool.GetSafeSqlandHtml(Request["select_option_type"]);
            title = Library_public.Tool.GetSafeSqlandHtml(Request["title"]);
            bewrite = Library_public.Tool.GetSafeSqlandHtml(Request["content"]);
            file_img = Library_public.Tool.GetSafeSqlandHtml(Request["file_img"]);
            price = Library_public.Tool.GetSafeSqlandHtml(Request["price"]);
            number = Library_public.Tool.GetSafeSqlandHtml(Request["number"]);
            date = Library_public.Tool.GetSafeSqlandHtml(Request["date"]);
            pointOfDeparture = Library_public.Tool.GetSafeSqlandHtml(Request["pointOfDeparture"]);
            // 文件上传后的保存路径
            string filePath = Server.MapPath("~/Upload/");
            if (!Directory.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }
            if (fileData == null)
            {
                return Redirect("Product");
            }
            string fileName = Path.GetFileName(fileData.FileName);// 原始文件名称
            string fileExtension = Path.GetExtension(fileName); // 文件扩展名
            string saveName = Guid.NewGuid().ToString() + fileExtension; // 保存文件名称
            fileData.SaveAs(filePath + saveName);

            Model.Product product = new Model.Product { JK_Product_DateTime = DateTime.Now, JK_Product_Imgsrc = saveName, JK_Product_parameten_1 = title, JK_Product_Bewrite = bewrite, };
            BLL.Product.Add(product);
            if (BLL.Product.Add(product) >= 1)
            {
                return Content("添加成功!");
            }

            return Redirect("Product");
        }