예제 #1
0
        public ActionResult Update(long id, String productName, Decimal price, String categoryId)
        {
            var rols = (byte[])Session["rols"];

            if (rols == null) //redirect to SinIn
            {
                return(RedirectToAction("Index", "Home"));
            }
            else if (rols.Contains <byte>(1))
            {
                var product = _products.GetOneById(id);
                product.productName = productName;
                product.price       = price;

                if (categoryId != "--Select--" && categoryId != "")
                {
                    product.categoryId = Int32.Parse(categoryId);
                }
                product.category = null;

                products newProducto = new products();
                newProducto.Update(product);

                return(RedirectToAction("Index"));
            }
            else//redirect to Home
            {
                return(RedirectToAction("Home", "Home"));
            }
        }
예제 #2
0
 public products products_update(int ID)
 {
     products                     = products.Select(ID);
     products.product_id          = Convert.ToInt32(Update_product_id_txt.Text);
     products.Resource_ID         = Convert.ToInt32(Update_Resource_ID_txt.Text);
     products.product_name        = Update_product_name_txt.Text;
     products.product_type        = Update_product_type_txt.Text;
     products.product_qty         = Convert.ToInt32(Update_product_qty_txt.Text);
     products.product_desc        = Update_product_desc_txt.Text;
     products.product_color       = Update_product_color_txt.Text;
     products.product_size        = Update_product_size_txt.Text;
     products.product_cost        = Convert.ToDecimal(Update_product_cost_txt.Text);
     products.Product_exp_date    = Convert.ToDateTime(Update_Product_exp_date_txt.Text);
     products.Product_Alergy_info = Update_Product_Alergy_info_txt.Text;
     products.Product_refrigde    = Update_Product_refrigde_txt.Text;
     products.Product_Flammable   = Update_Product_Flammable_txt.Text;
     products.Product_Hazard      = Update_Product_Hazard_txt.Text;
     products.Product_Other       = Update_Product_Other_txt.Text;
     products.Product_Min_Inv     = Convert.ToInt32(Update_Product_Min_Inv_txt.Text);
     products.Product_Barcode     = Update_Product_Barcode_txt.Text;
     products.Product_subtype     = Update_Product_subtype_txt.Text;
     products.Make                = Update_Make_txt.Text;
     products.Model               = Update_Model_txt.Text;
     products.FEMA_Description    = Update_FEMA_Description_txt.Text;
     products.Year                = Update_Year_txt.Text;
     products.RFID                = Update_RFID_txt.Text;
     products.Serial_Number       = Update_Serial_Number_txt.Text;
     products.Height              = Update_Height_txt.Text;
     products.Length              = Update_Length_txt.Text;
     products.Depth               = Update_Depth_txt.Text;
     products.Weight              = Update_Weight_txt.Text;
     products.OAI                 = Update_OAI_txt.Text;
     products.OAI_Type            = Update_OAI_Type_txt.Text;
     products.Use                 = Update_Use_txt.Text;
     products.Brand               = Update_Brand_txt.Text;
     products.Power_Supply        = Update_Power_Supply_txt.Text;
     products.Gas_Type            = Update_Gas_Type_txt.Text;
     products.Needs_Gas           = Convert.ToBoolean(Update_Needs_Gas_txt.Text);
     products.Needs_Electricity   = Convert.ToBoolean(Update_Needs_Electricity_txt.Text);
     products.Availability        = Update_Availability_txt.Text;
     products.Datetime            = Convert.ToDateTime(Update_Datetime_txt.Text);
     products.OpenStatus          = Update_OpenStatus_txt.Text;
     products.Update(products);
     Insert_products_GridView.DataBind();
     Update_products_GridView.DataBind();
     Delete_products_GridView.DataBind();
     return(products);
 }
예제 #3
0
        public ActionResult AddInventory(int addInventory, long id)
        {
            try
            {
                var product = _products.GetOneById(id);
                product.inventory += addInventory;

                //create a new BS products for update
                products newProductos = new products();
                newProductos.Update(product);

                return(Json(new { sucess = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
            }
            return(RedirectToAction("Index"));
        }
 public products products_update(int ID)
 {
     products = products.Select(ID);
     products.product_id = Convert.ToInt32(Update_product_id_txt.Text);
     products.Resource_ID = Convert.ToInt32(Update_Resource_ID_txt.Text);
     products.product_name = Update_product_name_txt.Text;
     products.product_type = Update_product_type_txt.Text;
     products.product_qty = Convert.ToInt32(Update_product_qty_txt.Text);
     products.product_desc = Update_product_desc_txt.Text;
     products.product_color = Update_product_color_txt.Text;
     products.product_size = Update_product_size_txt.Text;
     products.product_cost = Convert.ToDecimal(Update_product_cost_txt.Text);
     products.Product_exp_date = Convert.ToDateTime(Update_Product_exp_date_txt.Text);
     products.Product_Alergy_info = Update_Product_Alergy_info_txt.Text;
     products.Product_refrigde = Update_Product_refrigde_txt.Text;
     products.Product_Flammable = Update_Product_Flammable_txt.Text;
     products.Product_Hazard = Update_Product_Hazard_txt.Text;
     products.Product_Other = Update_Product_Other_txt.Text;
     products.Product_Min_Inv = Convert.ToInt32(Update_Product_Min_Inv_txt.Text);
     products.Product_Barcode = Update_Product_Barcode_txt.Text;
     products.Product_subtype = Update_Product_subtype_txt.Text;
     products.Make = Update_Make_txt.Text;
     products.Model = Update_Model_txt.Text;
     products.FEMA_Description = Update_FEMA_Description_txt.Text;
     products.Year = Update_Year_txt.Text;
     products.RFID = Update_RFID_txt.Text;
     products.Serial_Number = Update_Serial_Number_txt.Text;
     products.Height = Update_Height_txt.Text;
     products.Length = Update_Length_txt.Text;
     products.Depth = Update_Depth_txt.Text;
     products.Weight = Update_Weight_txt.Text;
     products.OAI = Update_OAI_txt.Text;
     products.OAI_Type = Update_OAI_Type_txt.Text;
     products.Use = Update_Use_txt.Text;
     products.Brand = Update_Brand_txt.Text;
     products.Power_Supply = Update_Power_Supply_txt.Text;
     products.Gas_Type = Update_Gas_Type_txt.Text;
     products.Needs_Gas = Convert.ToBoolean(Update_Needs_Gas_txt.Text);
     products.Needs_Electricity = Convert.ToBoolean(Update_Needs_Electricity_txt.Text);
     products.Availability = Update_Availability_txt.Text;
     products.Datetime = Convert.ToDateTime(Update_Datetime_txt.Text);
     products.OpenStatus = Update_OpenStatus_txt.Text;
     products.Update(products);
     Insert_products_GridView.DataBind();
     Update_products_GridView.DataBind();
     Delete_products_GridView.DataBind();
     return products;
 }