Beispiel #1
0
        public bool EstablishStore(string storeName)
        {
            if (!Stores.addStore(storeName, this))
            {
                return(false);
            }
            Stores.searchStore(storeName).addOwner(this);
            permmisions = new basePermmision("", null);
            aPermission temp1  = new addProduct(storeName, null);
            aPermission temp2  = new editManagerPermissions(storeName, null);
            aPermission temp3  = new editProduct(storeName, null);
            aPermission temp4  = new getInfoEmployees(storeName, null);
            aPermission temp5  = new getPurchaseHistory(storeName, null);
            aPermission temp6  = new hireNewStoreManager(storeName, null);
            aPermission temp7  = new hireNewStoreOwner(storeName, null);
            aPermission temp8  = new removeManager(storeName, null);
            aPermission temp9  = new removeProduct(storeName, null);
            aPermission temp10 = new removeOwner(storeName, null);

            permmisions.addPermission(temp1);
            permmisions.addPermission(temp2);
            permmisions.addPermission(temp3);
            permmisions.addPermission(temp4);
            permmisions.addPermission(temp5);
            permmisions.addPermission(temp6);
            permmisions.addPermission(temp7);
            permmisions.addPermission(temp8);
            permmisions.addPermission(temp9);
            permmisions.addPermission(temp10);
            return(true);
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            addProduct addProduct = db.AddProducts.Find(id);

            db.AddProducts.Remove(addProduct);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            addProduct f1 = new addProduct();

            this.Hide();
            f1.ShowDialog();
            this.Close();
        }
        public void addQuantity([FromBody] addProduct obj)
        {
            var myobj = obj;
            int pid   = myobj.id;

            Debug.WriteLine(pid);
            _addedQuantity.addQuantity(pid);
        }
Beispiel #5
0
 public ActionResult Edit([Bind(Include = "id,name,price,description,category_id,image")] addProduct addProduct)
 {
     if (ModelState.IsValid)
     {
         db.Entry(addProduct).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.category_id = new SelectList(db.Categories, "category_id", "name", addProduct.category_id);
     return(View(addProduct));
 }
Beispiel #6
0
        // GET: addProducts/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            addProduct addProduct = db.AddProducts.Find(id);

            if (addProduct == null)
            {
                return(HttpNotFound());
            }
            return(View(addProduct));
        }
Beispiel #7
0
        // GET: addProducts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            addProduct addProduct = db.AddProducts.Find(id);

            if (addProduct == null)
            {
                return(HttpNotFound());
            }
            ViewBag.category_id = new SelectList(db.Categories, "category_id", "name", addProduct.category_id);
            return(View(addProduct));
        }
Beispiel #8
0
 public ActionResult Create(addProduct addProduct, HttpPostedFileBase upload)
 {
     if (ModelState.IsValid)
     {
         string path = "";
         if (upload.FileName.Length > 0)
         {
             path = "~/Uploads/" + Path.GetFileName(upload.FileName);
             upload.SaveAs(Server.MapPath(path));
         }
         addProduct.image = path;
         var categoryindb = db.Categories.Single(c => c.category_id == addProduct.category_id);
         categoryindb.no_of_products++;
         db.AddProducts.Add(addProduct);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(Content("Done"));
 }
        public IActionResult InsertProduct(addProduct add)
        {
            try
            {
                string        connectionstring = configuration.GetConnectionString("DefaultConnectionString");
                SqlConnection connection       = new SqlConnection(connectionstring);
                connection.Open();
                string     sql = "insert into productDetails(catagory, subcatagory, productid, productname, productdetails, color, quantity, discount, price, image) values(@catagory,@subcatagory,@productid,@productname,@productdetails,@color,@quantity,@discount,@price,@image) ";
                SqlCommand com = new SqlCommand(sql, connection);
                com.Parameters.AddWithValue("@catagory", add.catagory);
                com.Parameters.AddWithValue("@subcatagory", add.subcatagory);
                com.Parameters.AddWithValue("@productid", add.productid);
                com.Parameters.AddWithValue("@productname", add.productname);
                com.Parameters.AddWithValue("@productdetails", add.productdetails);
                com.Parameters.AddWithValue("@color", add.color);
                com.Parameters.AddWithValue("@quantity", add.quantity);
                com.Parameters.AddWithValue("@discount", add.discount);
                com.Parameters.AddWithValue("@price", add.price);
                // com.Parameters.AddWithValue("@image", add.catagory);

                /*  if(file != null && file.ContentLength>0 )
                 * {
                 *     string filename = Path.GetFileName(file.FileName);
                 *
                 *     //string imgpath = Path.Combine(Microsoft.SqlServer.Server("~/productImage/"),filename);
                 * }*/
                com.ExecuteNonQuery();

                connection.Close();
            }
            catch (Exception e)
            {
            }


            return(View());
        }