private void SearchProducts()
        {
            ProductORM prodORM = new ProductORM();

            dtListProducts.DataSource = prodORM.ProductSearch(Request.Form["Search"]);
            dtListProducts.DataBind();
        }
 private void ProductGetList()
 {
     try
     {
         ProductORM prodORM = new ProductORM();
         if (string.IsNullOrEmpty(Request.QueryString["cID"]))
         {
             dtListProducts.DataSource = prodORM.List();
             dtListProducts.DataBind();
             dtListSinglePopup.DataSource = prodORM.List();
             dtListSinglePopup.DataBind();
         }
         else
         {
             dtListProducts.DataSource = prodORM.ProductInCategory(Convert.ToInt32(Request.QueryString["cID"]));
             dtListProducts.DataBind();
             dtListSinglePopup.DataSource = prodORM.ProductInCategory(Convert.ToInt32(Request.QueryString["cID"]));
             dtListSinglePopup.DataBind();
         }
     }
     catch
     {
         Response.Redirect("Products.aspx");
     }
 }
Ejemplo n.º 3
0
        private void ProductGetList()
        {
            ProductORM prodORM = new ProductORM();

            rptProduct.DataSource = prodORM.List();
            rptProduct.DataBind();
        }
Ejemplo n.º 4
0
 protected void rptProduct_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     try
     {
         bool result = false;
         if (e.CommandName == "btnDelete")
         {
             Button     btnDelete = e.Item.FindControl("btnDelete") as Button;
             ProductORM prodORM   = new ProductORM();
             result = prodORM.Delete(Convert.ToInt32(btnDelete.CommandArgument));
             if (result)
             {
                 rptProduct.DataSource = prodORM.List();
                 rptProduct.DataBind();
             }
         }
         else if (e.CommandName == "btnUpdate")
         {
             Session["ProductID"] = e.CommandArgument;
             Server.Transfer("NewProduct.aspx");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 5
0
 private void sellProductToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         string       productName  = lstwProducts.SelectedItems[0].Text;
         int          productID    = Convert.ToInt32(lstwProducts.SelectedItems[0].Tag);
         DialogResult dialogResult = MessageBox.Show("Seçili Ürünün Stok Miktarını " + toolStripTextBoxQuantity.Text + " Adet Eksiltmek İstediğinize Emin Misiniz ?", productName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dialogResult == DialogResult.Yes)
         {
             ProductORM prodORM = new ProductORM();
             bool       result  = prodORM.StockDecrease(productID, int.Parse(toolStripTextBoxQuantity.Text));
             if (result)
             {
                 MessageBox.Show("Stok Azaltma İşleminiz Başarıyla Gerçekleştirildi", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 ListViewProductFill(Convert.ToInt32(cbCategories.SelectedValue));
             }
             else
             {
                 MessageBox.Show("İşlem Sırasında Bir Hata Meydana Geldi !", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 6
0
        private void GetNewProducts()
        {
            ProductORM prodORM = new ProductORM();

            dtListNewProducts.DataSource = prodORM.GetNewProducts();
            dtListNewProducts.DataBind();
            dtListSingleProduct.DataSource = prodORM.GetNewProducts();
            dtListSingleProduct.DataBind();
        }
        protected void btnProductInsert_Click(object sender, EventArgs e)
        {
            try
            {
                bool result = false;
                if (btnProductInsert.Text == "Güncelle")
                {
                    Entity.Products prod = new Entity.Products
                    {
                        ProductID      = Convert.ToInt32(Session["ProductID"]),
                        ProductName    = txtProductName.Value,
                        Description    = txtProductAciklama.Value,
                        UnitPrice      = Convert.ToDecimal(txtProductPrice.Value),
                        UnitsInStock   = int.Parse(txtProductUnitsInStock.Value),
                        CategoryID     = int.Parse(drpCategory.SelectedItem.Value),
                        SmallPhotoPath = "Content/User/images/small/" + photoUpload.FileName,
                        LargePhotoPath = "Content/User/images/large/" + photoUpload.FileName
                    };
                    ProductORM prodORM = new ProductORM();
                    result = prodORM.Update(prod);
                    photoUpload.SaveAs(Server.MapPath("~/Content/User/images/large/" + photoUpload.FileName));
                }
                else
                {
                    Entity.Products prod = new Entity.Products
                    {
                        ProductName    = txtProductName.Value,
                        Description    = txtProductAciklama.Value,
                        UnitPrice      = Convert.ToDecimal(txtProductPrice.Value),
                        UnitsInStock   = int.Parse(txtProductUnitsInStock.Value),
                        CategoryID     = int.Parse(drpCategory.SelectedItem.Value),
                        SmallPhotoPath = "Content/User/images/small/" + photoUpload.FileName,
                        LargePhotoPath = "Content/User/images/large/" + photoUpload.FileName
                    };
                    ProductORM prodORM = new ProductORM();
                    result = prodORM.Insert(prod);
                    photoUpload.SaveAs(Server.MapPath("~/Content/User/images/large/" + photoUpload.FileName));
                }

                if (result)
                {
                    eklemeBilgi.Visible   = true;
                    eklemeBilgi.InnerText = "İşleminiz Başarıyla Gerçekleştirildi.";
                }
                else
                {
                    eklemeBilgi.Visible   = true;
                    eklemeBilgi.InnerText = "İşleminiz Gerçekleştirilemedi.";
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 8
0
        private void SaleForm_Load(object sender, EventArgs e)
        {
            CustomerORM csOrm = new CustomerORM();

            cmbCustomer.DataSource    = csOrm.Select();
            cmbCustomer.DisplayMember = "Name";
            cmbCustomer.ValueMember   = "id";

            RoomsORM rOrm = new RoomsORM();

            cmbRoom.DataSource    = rOrm.Select();
            cmbRoom.DisplayMember = "Name";
            cmbRoom.ValueMember   = "id";

            ProductORM pOrm = new ProductORM();

            dataGridView1.DataSource = pOrm.Select();
        }
Ejemplo n.º 9
0
        private void SelectedProductGet()
        {
            try
            {
                if (string.IsNullOrEmpty(Request.QueryString["pID"]))
                {
                    Response.Redirect("Products.aspx");
                    return;
                }

                ProductORM prodORM = new ProductORM();

                selectedProduct = prodORM.SingleProduct(int.Parse(Request.QueryString["pID"]));
            }
            catch
            {
                Response.Redirect("Products.aspx");
            }
        }
 private void ProductUpdateItem()
 {
     if (Session["ProductID"] != null)
     {
         ProductORM      prodORM = new ProductORM();
         Entity.Products prod    = prodORM.SingleProduct(Convert.ToInt32(Session["ProductID"]));
         txtProductName.Value         = prod.ProductName;
         txtProductAciklama.Value     = prod.Description;
         txtProductPrice.Value        = prod.UnitPrice.ToString();
         txtProductUnitsInStock.Value = prod.UnitsInStock.ToString();
         for (int i = 0; i < drpCategory.Items.Count; i++)
         {
             if (drpCategory.Items[i].Value == prod.CategoryID.ToString())
             {
                 drpCategory.Items[i].Selected = true;
             }
         }
         btnProductInsert.Text = "Güncelle";
     }
 }
Ejemplo n.º 11
0
 private void btnAddProduct_Click(object sender, EventArgs e)
 {
     try
     {
         Products prod = new Products
         {
             ProductName     = txtProductName.Text,
             CategoryID      = (int)cbAddCategories.SelectedValue,
             QuantityPerUnit = txtProductUnit.Text,
             UnitPrice       = Convert.ToDecimal(txtProductPrice.Text),
             UnitsInStock    = (int)nUdUnitsInStock.Value
         };
         ProductORM prodORM = new ProductORM();
         bool       result  = prodORM.Insert(prod);
         if (result)
         {
             MessageBox.Show("Ürün Ekleme İşleminiz Başarıyla Gerçekleştirildi", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             ListViewProductFill(Convert.ToInt32(cbAddCategories.SelectedValue));
             cbCategories.SelectedIndex       = cbAddCategories.SelectedIndex;
             tabControlProducts.SelectedIndex = 0;
             ProductControlsClear(true);
         }
         else
         {
             MessageBox.Show("İşlem Sırasında Bir Hata Meydana Geldi !", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch
     {
         MessageBox.Show("Fiyat Girişi Yapılırken Bir Sorunla Karşılaşıldı");
         txtProductPrice.Clear();
         txtProductPrice.Focus();
     }
 }
Ejemplo n.º 12
0
 void ListViewProductFill(int categoryID, string searchText)
 {
     try
     {
         lstwProducts.Items.Clear();
         ProductORM prodORM = new ProductORM();
         DataTable  dt      = prodORM.ProductSearch(categoryID, searchText);
         foreach (DataRow item in dt.Rows)
         {
             ListViewItem li = new ListViewItem();
             li.Tag  = item["ProductID"].ToString();
             li.Text = item["ProductName"].ToString();
             li.SubItems.Add(item["UnitPrice"].ToString());
             li.SubItems.Add(item["QuantityPerUnit"].ToString());
             if (Convert.ToInt32(item["UnitsInStock"]) < 15)
             {
                 li.SubItems.Add(item["UnitsInStock"].ToString());
                 li.BackColor = Color.Red;
             }
             else
             {
                 li.SubItems.Add(item["UnitsInStock"].ToString());
             }
             li.SubItems.Add(item["CategoryName"].ToString());
             lstwProducts.Items.Add(li);
         }
         lstwProducts.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message);
         MessageBox.Show("Ürünleri Listeleme İşleminde Bir Hata İle Karşılaşıldı");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 13
0
        private void RelatedProducts(int categoryID)
        {
            ProductORM prodORM = new ProductORM();
            DataTable  dt      = prodORM.ProductInCategory(categoryID);

            foreach (DataRow item in dt.Rows)
            {
                Entity.Products prod = new Entity.Products
                {
                    ProductID      = Convert.ToInt32(item["ProductID"]),
                    ProductName    = item["ProductName"].ToString(),
                    Description    = item["Description"].ToString(),
                    CategoryID     = Convert.ToInt32(item["CategoryID"]),
                    LargePhotoPath = item["LargePhotoPath"].ToString(),
                    UnitPrice      = Convert.ToDecimal(item["UnitPrice"]),
                    UnitsInStock   = Convert.ToInt32(item["UnitPrice"]),
                    SmallPhotoPath = item["SmallPhotoPath"].ToString()
                };
                RelatedProductsList.Add(prod);
            }

            dtListSinglePopup.DataSource = prodORM.ProductInCategory(categoryID);
            dtListSinglePopup.DataBind();
        }