예제 #1
0
        public ActionResult CreateAd(tbl_product pvm, HttpPostedFileBase imgfile)
        {
            List <tbl_category> li = db.tbl_category.ToList();

            ViewBag.categorylist = new SelectList(li, "cat_id", "cat_name");

            string path = uploadimgfile(imgfile);

            if (path.Equals("-1"))
            {
                ViewBag.error = "Image could not be uploaded....";
            }
            else
            {
                tbl_product p = new tbl_product();
                p.pro_name   = pvm.pro_name;
                p.pro_price  = pvm.pro_price;
                p.pro_image  = path;
                p.pro_fk_cat = pvm.pro_fk_cat;
                p.pro_des    = pvm.pro_des;
                p.pro_fk_us  = Convert.ToInt32(Session["u_id"].ToString());
                db.tbl_product.Add(p);
                db.SaveChanges();
                Response.Redirect("index");
            }
            return(View());
        }
예제 #2
0
        // GET: product/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_product tbl_product = db.tbl_product.Find(id);

            if (tbl_product == null)
            {
                return(HttpNotFound());
            }
            var category             = db.tbl_category.ToList();
            List <SelectListItem> li = new List <SelectListItem>();

            li.Add(new SelectListItem {
                Text = "[Select a category]", Value = "0"
            });
            foreach (var c in category)
            {
                li.Add(new SelectListItem {
                    Text = c.category, Value = c.catID.ToString()
                });
                ViewBag.category = li;
            }
            //ViewBag.categoryID = new SelectList(db.tbl_category, "catID", "category", tbl_product.categoryID);
            ViewBag.colourID = new SelectList(db.tbl_colour, "colID", "colour", tbl_product.colourID);
            //ViewBag.modelID = new SelectList(db.tbl_model, "modID", "model", tbl_product.modelID);
            ViewBag.sizeID = new SelectList(db.tbl_size, "sizID", "size", tbl_product.sizeID);
            //ViewBag.subCategoryID = new SelectList(db.tbl_sub_category, "subID", "subcategory", tbl_product.subCategoryID);
            return(View(tbl_product));
        }
예제 #3
0
 public bool InsertIns(mProduct pPrd)
 {
     try
     {
         tbl_product vPrd  = new tbl_product();
         var         query = from b in Db.tbl_product
                             orderby b.product_id descending
                             select b;
         vPrd = query.FirstOrDefault();
         tbl_product p   = new tbl_product();
         Random      rnd = new Random();
         p.product_img1    = pPrd.product_img1;
         p.product_img2    = pPrd.product_img2;
         p.product_img_alt = pPrd.product_img_alt;
         p.product_price   = pPrd.product_price;
         p.product_summery = pPrd.product_summery;
         p.product_title1  = pPrd.product_title1;
         p.product_title2  = pPrd.product_title2;
         p.product_cat     = pPrd.product_cat;
         p.product_parent  = pPrd.product_parent;
         p.product_exist   = pPrd.product_exist;
         p.product_exp     = pPrd.product_exp;
         p.product_save    = pPrd.product_save;
         p.product_visit   = 200;
         p.product_id      = vPrd.product_id + 1;
         Db.tbl_product.Add(p);
         return(Convert.ToBoolean(Db.SaveChanges()));
     }
     catch (Exception)
     {
         return(false);
     }
 }
    // 单个删除
    protected void lbtnDelCa_Click(object sender, EventArgs e)
    {
        // 当前点击的按钮
        LinkButton           lb   = (LinkButton)sender;
        int                  caId = int.Parse(lb.CommandArgument);
        tbl_sinkia_attribute bll  = new tbl_sinkia_attribute();

        bll.GetModel(caId);

        string      attribute_name = bll.attribute_name;
        tbl_product bllpp          = new tbl_product();

        bllpp.pro_level = caId;
        if (!bllpp.Existsshuxing())//查找是否存在下级商品
        {
            bll.Delete(caId);

            mym.JscriptMsg(this.Page, " 成功删除属性:" + attribute_name + "", Utils.CombUrlTxt("pro_attribute_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success");
        }
        else
        {
            mym.JscriptMsg(this.Page, "有商品属于该商品属性,不能删除!", "", "Error");
            return;
        }
    }
예제 #5
0
    private void ShowInfo(int _id)
    {
        tbl_product model1 = new tbl_product();

        model1.GetModel(_id);


        this.ddlproduct_category_id.SelectedValue = model1.pro_pid.ToString();
        this.txtdw.Text           = model1.pro_danwei;
        this.txtImgUrl.Text       = model1.pro_imgs;
        this.txtImgUrl1.Text      = model1.pro_imgs1;
        this.txtImgUrl2.Text      = model1.pro_imgs2;
        this.txtproduct_name.Text = model1.pro_name;
        this.txtgo_price.Text     = MyConvert(model1.go_price.ToString());
        this.txtsalse_price.Text  = MyConvert(model1.salse_price.ToString());
        //this.pv.Text = MyConvert(model1.pro_PV.ToString());
        this.txtContent.Value        = model1.pro_memo.ToString();
        this.attribute.SelectedValue = model1.pro_level.ToString();//属性绑定
        this.txtproduct_num.Text     = model1.pro_num.ToString();
        //if (model1.pro_type == 0)
        //{
        //    this.cbIsLock.Checked = true;
        //}
        //if (model1.flag == 0)
        //{
        //    this.shengji.Checked = true;
        //}
        if (model1.pro_isok == 1)
        {
            this.pro_isok.Checked = true;
        }
        else
        {
            this.pro_isok.Checked = false;
        }

        if (model1.pro_home_show == 1)
        {
            this.pro_home_show.Checked = true;
        }
        else
        {
            this.pro_home_show.Checked = false;
        }

        if (model1.pro_Hot == 1)
        {
            this.pro_Hot.Checked = true;
        }
        else
        {
            this.pro_Hot.Checked = false;
        }
        this.ddlprov.SelectedValue = model1.province_id.ToString();
        this.ddlcity.SelectedValue = model1.city_id.ToString();
        this.ddlarea.SelectedValue = model1.dictrict_id.ToString();
        //this.shop.Text = MyConvert(model1.shop_fen.ToString());
        //this.yun.Text = MyConvert(model1.cloud_fen.ToString());
        //this.chongxiao.Text = MyConvert(model1.futou_fen.ToString());
    }
예제 #6
0
        public ActionResult CreateAd(tbl_product pvm, HttpPostedFileBase imgfile)
        {
            List <tbl_category> li = db.tbl_category.ToList();

            ViewBag.categorylist = new SelectList(li, "category_id", "category_name");


            string path = uploadimgfile(imgfile);

            if (path.Equals("-1"))
            {
                ViewBag.error = "Görsel Yüklenemedi....";
            }
            else
            {
                tbl_product p = new tbl_product();
                p.product_name        = pvm.product_name;
                p.product_price       = pvm.product_price;
                p.product_image       = path;
                p.product_fk_category = pvm.product_fk_category;
                p.product_description = pvm.product_description;
                p.product_fk_user     = Convert.ToInt32(Session["userid"].ToString());
                db.tbl_product.Add(p);
                db.SaveChanges();
                Response.Redirect("index");
            }
            return(View());
        }
예제 #7
0
        public ActionResult addprod(product pr, HttpPostedFileBase file1)
        {
            ViewBag.cat = new SelectList(dc.tbl_category, "cid", "cname");

            tbl_product tr = new tbl_product();

            tr.pname     = pr.pname;
            tr.pcategory = pr.catid;
            tr.pprice    = pr.pprice;
            tr.pdetails  = pr.pdetails;
            if (file1 != null)
            {
                filename = file1.FileName;
                path     = Server.MapPath("~/image/~");
                fullpath = path + "\\" + filename;
                file1.SaveAs(fullpath);
                temp = "~/image/" + filename;
            }
            else
            {
                temp = "";
            }
            tr.pimg = temp;
            dc.tbl_product.Add(tr);
            dc.SaveChanges();
            return(View());
        }
예제 #8
0
        public ActionResult Adtocart(tbl_product pi, string qty, int Id)
        {
            tbl_product p = db.tbl_product.Where(x => x.product_id == Id).SingleOrDefault();

            Cart c = new Cart();

            c.product_id   = p.product_id;
            c.price        = (float)p.product_price;
            c.qty          = Convert.ToInt32(qty);
            c.bill         = c.price * c.qty;
            c.product_name = p.product_name;
            if (TempData["Cart"] == null)
            {
                li.Add(c);
                TempData["Cart"] = li;
            }
            else
            {
                List <Cart> li2 = TempData["Cart"] as List <Cart>;
                li2.Add(c);
                TempData["Cart"] = li2;
            }

            TempData.Keep();



            return(RedirectToAction("Index"));
        }
예제 #9
0
    // 单个删除
    protected void lbtnDelCa_Click(object sender, EventArgs e)
    {
        // 当前点击的按钮
        LinkButton       lb   = (LinkButton)sender;
        int              caId = int.Parse(lb.CommandArgument);
        tbl_sinkia_class bll  = new tbl_sinkia_class();

        bll.GetModel(caId);

        string      pro_class = bll.pro_class;
        tbl_product bllpp     = new tbl_product();

        bllpp.pro_pid = caId;
        if (!bllpp.ExistsBM())//查找是否存在下级商品
        {
            bll.Delete(caId);

            mym.JscriptMsg(this.Page, " 成功删除商品类别:" + pro_class + "", Utils.CombUrlTxt("pro_class_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success");
        }
        else
        {
            mym.JscriptMsg(this.Page, "有商品属于该商品类别,不能删除!", "", "Error");
            return;
        }
    }
예제 #10
0
        public ActionResult addproduct(pclass f, HttpPostedFileBase file1)
        {
            ViewBag.cat = new SelectList(dc.tbl_category, "catid", "catname");
            tbl_product pr = new tbl_product();

            pr.pname     = f.pname;
            pr.pcategory = f.catid;
            pr.pprice    = f.pprice;
            pr.pdetail   = f.pdetail;
            if (file1 != null)
            {
                filename = file1.FileName;
                path     = Server.MapPath("~/img/");
                fulpath  = path + filename;
                file1.SaveAs(fulpath);
                temp = "~/img/" + filename;
            }
            else
            {
                temp = "";
            }
            pr.pimage = temp;
            dc.tbl_product.Add(pr);
            dc.SaveChanges();
            return(View());
        }
예제 #11
0
        public ActionResult CreateAd(tbl_product tblProduct, HttpPostedFileBase imgFile)
        {
            string path = UploadImageFile(imgFile);

            if (path.Equals("-1"))
            {
                ViewBag.ErrorMessage = "File could not be uploaded......";
            }
            else
            {
                tbl_product p = new tbl_product();
                p.pro_name        = tblProduct.pro_name;
                p.pro_image       = path;
                p.pro_description = tblProduct.pro_description;
                p.pro_price       = tblProduct.pro_price;
                p.pro_fk_cat      = tblProduct.pro_fk_cat;
                p.pro_fk_user     = Convert.ToInt32(Session["u_id"].ToString());

                db.tbl_product.Add(p);
                db.SaveChanges();

                Response.Redirect("Index");
            }
            return(View());
        }
예제 #12
0
        public async Task <ActionResult> Edit(Product model)
        {
            if (!GetTokenValidation(ApplicationSession.Session.Token))
            {
                return(RedirectToAction("Index", "Login"));
            }
            ViewBag.ProductType = await ProductTyp();

            try
            {
                tbl_product dbmodel = db.tbl_product.Where(x => x.Id == model.Id).FirstOrDefault();
                dbmodel.Id            = model.Id;
                dbmodel.Name          = model.Name;
                dbmodel.ProductTypeId = model.ProductTypeId;
                dbmodel.Code          = model.Code;
                db.SaveChanges();
                SetNotification("info", "Record save update");
                return(RedirectToAction("Index"));
            }
            catch
            {
                SetNotification("error", "Error Record not update");
                return(View());
            }
        }
예제 #13
0
    /// <summary>
    /// 获得购物车列表
    /// </summary>
    public static IList <cart_items> GetList()
    {
        IDictionary <string, int> dic = GetCart();

        if (dic != null)
        {
            IList <cart_items> iList = new List <cart_items>();

            foreach (var item in dic)
            {
                tbl_product model = new tbl_product();
                model.GetModel(Convert.ToInt32(item.Key.Split('|')[0]));

                cart_items modelt = new cart_items();
                modelt.id                  = model.pro_id;
                modelt.title               = model.pro_name;
                modelt.goprice             = Utils.StrToDecimal(model.go_price.ToString(), 0);
                modelt.img_url             = model.pro_imgs;
                modelt.product_category_id = Convert.ToInt32(model.pro_pid);
                modelt.dw                  = model.pro_danwei;
                modelt.price               = Utils.StrToDecimal(model.salse_price.ToString(), 0);
                modelt.quantity            = item.Value;
                modelt.shuxing             = item.Key.Split('|')[1];
                modelt.key_shuxing         = item.Key;
                iList.Add(modelt);
            }
            return(iList);
        }
        return(null);
    }
예제 #14
0
        public ActionResult Create(tbl_product tbl_product, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                if (file != null && file.ContentLength > 0)
                {
                    try
                    {
                        string PathToFolder = Server.MapPath("~/Images");
                        string fileName     = Path.GetFileName(file.FileName);
                        string path         = Path.Combine(PathToFolder, fileName);
                        file.SaveAs(path);
                        tbl_product.Image = file.FileName;
                    }
                    catch (Exception ex)
                    {
                        ViewBag.Message = "ERROR:" + ex.Message.ToString();
                    }
                }


                db.tbl_product.Add(tbl_product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryId = new SelectList(db.tbl_category, "CategoryId", "Name", tbl_product.CategoryId);
            return(View(tbl_product));
        }
예제 #15
0
        public ActionResult CreateShortUrl(int id)
        {
            tbl_product t = (from product in db.tbl_product
                             where product.product_id == id
                             select product).Single();
            string webUrl = "";

            webUrl = Config.ConfigManager.getConfig("get-short-url");
            byte[]         dataArray  = Encoding.UTF8.GetBytes(t.content_url);
            WebRequest     webRequest = WebRequest.Create(webUrl);
            HttpWebRequest request    = webRequest as HttpWebRequest;

            request.Method        = "POST";
            request.ContentLength = dataArray.Length;
            Stream dataStream = request.GetRequestStream();

            dataStream.Write(dataArray, 0, dataArray.Length);
            dataStream.Close();

            WebResponse response = request.GetResponse();
            String      shortUrl = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();

            t.short_url = shortUrl;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #16
0
        public DataTable GetProduct(tbl_product p, tbl_stock s)
        {
            DataTable programs = new DataTable();

            try
            {
                Dictionary <string, object> parameters = new Dictionary <string, object>();
                parameters.Add("@company_id ", p.company_id);
                parameters.Add("@branch_id", p.branch_id);
                DataTable dt = helper.GetDataTableFromStoredProc(SP.productwithquantity, parameters);
                foreach (DataRow dr in dt.Rows)
                {
                    p.product_id   = Convert.ToInt32(dr["product_id"].ToString());
                    p.product_name = (dr["product_name"].ToString());

                    p.product_code  = (dr["product_code"].ToString());
                    p.purchas_price = Convert.ToDecimal(dr["purchas_price"].ToString());
                    p.sales_price   = Convert.ToDecimal(dr["sales_price"].ToString());
                    s.qty           = Convert.ToInt32(dr["qty"].ToString());
                    p.reorder_level = Convert.ToInt32(dr["reorder_level"].ToString());
                }
                programs = dt;
            }
            catch (Exception ex)
            {
                ErrorLog.saveerror(ex);
            }
            return(programs);
        }
        public ActionResult Deleteconfirmed(int id)
        {
            tbl_product tbl_pro = db.tbl_product.Find(id);

            db.tbl_product.Remove(tbl_pro);
            db.SaveChanges();
            return(RedirectToAction("ViewCategory"));
        }
예제 #18
0
        //
        // GET: /Product/Edit/5

        public ActionResult Edit(int id)
        {
            tbl_product tbl_product = db.tbl_product.Single(t => t.product_id == id);

            ViewBag.types       = new SelectList(db.tbl_product_type.ToList(), "id", "name");
            ViewBag.push_levels = new SelectList(PushLevelModel.GetPushLevelList(), "level", "name");
            return(View(tbl_product));
        }
예제 #19
0
        public ActionResult Delete(int?id)
        {
            tbl_product p = db.tbl_product.Where(x => x.pro_id == id).SingleOrDefault();

            db.tbl_product.Remove(p);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #20
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_product tbl_product = db.tbl_product.Find(id);

            db.tbl_product.Remove(tbl_product);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #21
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_product temp = db.tbl_product.Single(m => m.product_id == id);

            temp.product_status = false;
            temp.push_level     = 0;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #22
0
        //
        // GET: /Product/Details/5

        public ActionResult Details(int id = 0)
        {
            tbl_product tbl_product = db.tbl_product.Find(id);

            if (tbl_product == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_product));
        }
예제 #23
0
 public ActionResult Edit([Bind(Include = "Id,anbarId,category,codeKala,name,date1,date2,serialNumber,barcode,temperetureMin,temperetureMax,minOrder,maxOrder,active")] tbl_product tbl_product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tbl_product));
 }
예제 #24
0
        public List <tbl_product> GetPriceOutlist(tbl_product model, string connString)
        {
            SqlParameter[] param =
            {
                new SqlParameter("@product_ID", 680)
            };

            return(SqlHelper.ExtecuteProcedureReturnData <List <tbl_product> >(connString,
                                                                               "GetProductByID", r => r.TranslateAsOutputTest(), param));
        }
예제 #25
0
    protected void btnsave_Click(object sender, EventArgs e)
    {
        try
        {
            if (filefrontimage.HasFile)
            {
                string serverpath = Server.MapPath("..") + "\\img\\" + filefrontimage.FileName;
                filefrontimage.SaveAs(serverpath);
                string urlfront = filefrontimage.FileName;

                tbl_product proObj = new tbl_product();
                proObj.prodname = txtprodname.Text;
                proObj.fkcomid = int.Parse(ddlselectcompany.SelectedValue.ToString());
                proObj.fksid = int.Parse(ddlsubcat.SelectedValue.ToString());
                proObj.mandate = txtmanudate.Text;
                proObj.warryear = txtwarryear.Text;
                proObj.warrmonth = txtwarrmonth.Text;
                proObj.warrday = txtwarrday.Text;
                proObj.stock = txtstock.Text;
                proObj.prize = txtprize.Text;
                proObj.frontimage = urlfront;
                proObj.port = txtport.Text;
                proObj.modalid = txtmodelid.Text;
                proObj.modalname = txtmodelname.Text;
                proObj.color = txtcolor.Text;
                proObj.lifestyle = txtlifestyle.Text;
                proObj.batterycell = txtbattterycell.Text;
                proObj.hardwareinterface = txthardwareinterface.Text;
                proObj.systemarchitutecture = txtsysarchite.Text;
                proObj.processer = txtprocessername.Text;
                proObj.harddisk = txtharddisk.Text;
                proObj.harddisk = txtharddisk.Text;
                proObj.frontcamera = txtwebcamera.Text;
                proObj.speaker = txtspeakers.Text;
                proObj.batterycell = txtbattterycell.Text;
                proObj.lockport = txtlockport.Text;
                proObj.os = txtos.Text;
                proObj.ram = txtram.Text;
                proObj.weight = txtweight.Text;
                proObj.graphicprocess = txtgraphicprocesser.Text;
                proObj.maxresoulution = txtmaxresolution.Text;
                proObj.bluethooth = ddlbluethooth.SelectedValue.ToString();
                proObj.wifi = ddlwifi.SelectedValue.ToString();

                db.tbl_products.InsertOnSubmit(proObj);
                db.SubmitChanges();

                lblmsg.Text = "Data Successfully Insert";
            }
        }
        catch (Exception ee)
        {
            lblmsg.Text = ee.Message;
        }
    }
예제 #26
0
 public ActionResult Edit(tbl_product tbl_product)
 {
     if (ModelState.IsValid)
     {
         db.tbl_product.Attach(tbl_product);
         db.ObjectStateManager.ChangeObjectState(tbl_product, EntityState.Modified);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tbl_product));
 }
예제 #27
0
        public async Task <int> Delete(Tbl_productRequest tbl_productRequest)
        {
            var tbl_product = new tbl_product()
            {
                id = tbl_productRequest.id
            };

            _context.tbl_products.Remove(tbl_product);

            return(await _context.SaveChangesAsync());
        }
예제 #28
0
 public ActionResult Edit(tbl_product tbl_product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.tbl_category, "CategoryId", "Name", tbl_product.CategoryId);
     return(View(tbl_product));
 }
예제 #29
0
        //
        // GET: /Product/Edit/5

        public ActionResult Edit(int id = 0)
        {
            tbl_product tbl_product = db.tbl_product.Find(id);

            if (tbl_product == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CategoryId = new SelectList(db.tbl_category, "CategoryId", "Name", tbl_product.CategoryId);
            return(View(tbl_product));
        }
예제 #30
0
 public ActionResult Edit([Bind(Include = "pid,pname,pprice,pdetails,cid")] tbl_product tbl_product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.cid = new SelectList(db.tbl_category, "cid", "cname", tbl_product.cid);
     return(View(tbl_product));
 }
        public ActionResult AddProduct(tbl_product pd)
        {
            EFDALLib dal = new EFDALLib();

            dal.AddProducts(pd);
            var catid = dal.GetAllCategoryById().ToList();

            ViewData.Add("cid", catid);
            ViewData.Add("Message", "Product Added Successfully");

            return(View());
        }
    protected void btnsave_Click(object sender, EventArgs e)
    {
        try
        {
            if (filefrontimage.HasFile && filebackimage.HasFile)
            {
                string serverpath = Server.MapPath("..") + "\\img\\" + filefrontimage.FileName;
                filefrontimage.SaveAs(serverpath);
                string urlfront = filefrontimage.FileName;

                string serverpath1 = Server.MapPath("..") + "\\img\\" + filebackimage.FileName;
                filebackimage.SaveAs(serverpath);
                string urlback = filebackimage.FileName;

                tbl_product proObj = new tbl_product();
                proObj.prodname = txtprodname.Text;
                proObj.fkcomid = int.Parse(ddlselectcompany.SelectedValue.ToString());
                proObj.fksid = int.Parse(ddlsubcat.SelectedValue.ToString());
                proObj.mandate = txtmanudate.Text;
                proObj.warryear = txtwarryear.Text;
                proObj.warrmonth = txtwarrmonth.Text;
                proObj.warrday = txtwarrday.Text;
                proObj.stock = txtstock.Text;
                proObj.prize = txtprize.Text;
                proObj.frontimage = urlfront;
                proObj.backimage = urlback;
                proObj.modalid = txtmodelid.Text;
                proObj.modalname = txtmodelname.Text;
                proObj.color = txtcolor.Text;
                proObj.weight = txtweight.Text;
                proObj.internalmemory = txtinternalmemory.Text;
                proObj.externalmemory = txtextrnalmemory.Text;
                proObj.batterytype = txtbattry.Text;
                proObj.batterycell = txtbattrycell.Text;
                proObj.frontcamera = txtfrontcamera.Text;
                proObj.displaysize = txtdsize.Text;

                db.tbl_products.InsertOnSubmit(proObj);
                db.SubmitChanges();

                lblmsg.Text = "Data Successfully Insert";
            }
        }
        catch (Exception ee)
        {
            lblmsg.Text = ee.Message;
        }
    }
예제 #33
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (filefrontimage.HasFile)
            {
                string serverpath = Server.MapPath("..") + "\\img\\" + filefrontimage.FileName;
                filefrontimage.SaveAs(serverpath);
                string urlfront = filefrontimage.FileName;

                tbl_product proObj = new tbl_product();
                proObj.prodname = txtprodname.Text;
                proObj.fkcomid = int.Parse(ddlselectcompany.SelectedValue.ToString());
                proObj.fksid = int.Parse(ddlsubcat.SelectedValue.ToString());
                proObj.mandate = txtmanudate.Text;
                proObj.warryear = txtwarryear.Text;
                proObj.warrmonth = txtwarrmonth.Text;
                proObj.warrday = txtwarrday.Text;
                proObj.stock = txtstock.Text;
                proObj.prize = txtprize.Text;
                proObj.frontimage = urlfront;
                proObj.modalid = txtmodelid.Text;
                proObj.modalname = txtmodelname.Text;
                proObj.color = txtcolor.Text;
                proObj.processer = txtprocessername.Text;
                proObj.harddisk = txthadrdiskcap.Text;
                proObj.os = txtos.Text;
                proObj.ram = txtram.Text;
                proObj.java = txtram.Text;
                proObj.opticaldrive = txtopticaldrive.Text;
                proObj.weight = txtweight.Text;
                proObj.graphicprocess = txtgraphicsprocesser.Text;
                proObj.keybord = txtkeybord.Text;
                proObj.maxresoulution = txtmaximunresol.Text;

                db.tbl_products.InsertOnSubmit(proObj);
                db.SubmitChanges();

                lblmsg.Text = "Data Successfully Insert";
            }
        }
        catch (Exception ee)
        {
            lblmsg.Text = ee.Message;
        }
    }
예제 #34
0
    protected void btnUpdateAccess_Click(object sender, EventArgs e)
    {
        TextBox ProductName = (TextBox)DetailsView4.FindControl("txtprodname");
        DropDownList fkcomid = (DropDownList)DetailsView4.FindControl("ddlselectcompany");
        TextBox stock = (TextBox)DetailsView4.FindControl("txtstock");
        DropDownList fksid = (DropDownList)DetailsView4.FindControl("ddlsubcata");
        TextBox prize = (TextBox)DetailsView4.FindControl("txtprize");
        FileUpload filefrontimage = (FileUpload)DetailsView4.FindControl("filefrontimage");
        FileUpload filebackimage = (FileUpload)DetailsView4.FindControl("filebackimage");
        TextBox modelid = (TextBox)DetailsView4.FindControl("txtmodelid");
        TextBox modelname = (TextBox)DetailsView4.FindControl("txtmodelname");
        TextBox color = (TextBox)DetailsView4.FindControl("txtcolor");
        TextBox frontcamera = (TextBox)DetailsView4.FindControl("txtfrontcamera");
        TextBox backcamera = (TextBox)DetailsView4.FindControl("txtbackcamera");
        TextBox internalmemory = (TextBox)DetailsView4.FindControl("txtinternalmemory");
        TextBox externalmemory = (TextBox)DetailsView4.FindControl("txtextrnalmemory");
        TextBox weight = (TextBox)DetailsView4.FindControl("txtweight");
        TextBox batterytype = (TextBox)DetailsView4.FindControl("txtbattry");
        TextBox batterycell = (TextBox)DetailsView4.FindControl("txtbattrycell");

        if (filefrontimage.HasFile && filebackimage.HasFile)
        {
            string serverpath = Server.MapPath("..") + "\\img\\" + filefrontimage.FileName;
            filefrontimage.SaveAs(serverpath);
            string urlfront = filefrontimage.FileName;

            string serverpath1 = Server.MapPath("..") + "\\img\\" + filebackimage.FileName;
            filebackimage.SaveAs(serverpath);
            string urlback = filebackimage.FileName;

            tbl_product proObj = new tbl_product();
            proObj = db.tbl_products.Single(data => data.pkprodid == int.Parse(DetailsView4.DataKey[0].ToString()));
            proObj.prodname = ProductName.Text;
            proObj.fkcomid = int.Parse(fkcomid.SelectedValue.ToString());
            proObj.fksid = int.Parse(fksid.SelectedValue.ToString());
            proObj.stock = stock.Text;
            proObj.prize = prize.Text;
            proObj.frontimage = urlfront;
            proObj.backimage = urlback;
            proObj.modalid = modelid.Text;
            proObj.modalname = modelname.Text;
            proObj.color = color.Text;
            proObj.weight = weight.Text;
            proObj.internalmemory = internalmemory.Text;
            proObj.externalmemory = externalmemory.Text;
            proObj.batterytype = batterytype.Text;
            proObj.batterycell = batterycell.Text;
            proObj.frontcamera = frontcamera.Text;
            proObj.backcamera = backcamera.Text;

            db.SubmitChanges();
            Response.Redirect("ViewAccessoriesProduct.aspx");
        }
    }
예제 #35
0
    protected void btnsave_Click(object sender, EventArgs e)
    {
        TextBox ProductName = (TextBox)DetailsView1.FindControl("txtprodname");
        DropDownList fkcomid = (DropDownList)DetailsView1.FindControl("ddlselectcompany");
        TextBox stock = (TextBox)DetailsView1.FindControl("txtstock");
        DropDownList fksid = (DropDownList)DetailsView1.FindControl("ddlsubcat");
        TextBox prize = (TextBox)DetailsView1.FindControl("txtprize");
        FileUpload filefrontimage = (FileUpload)DetailsView1.FindControl("filefrontimage");
        FileUpload filebackimage = (FileUpload)DetailsView1.FindControl("filebackimage");
        TextBox modelid = (TextBox)DetailsView1.FindControl("txtmodelid");
        TextBox modelname = (TextBox)DetailsView1.FindControl("txtmodelname");
        TextBox color = (TextBox)DetailsView1.FindControl("txtcolor");
        DropDownList touch = (DropDownList)DetailsView1.FindControl("ddltouch");
        TextBox simtype = (TextBox)DetailsView1.FindControl("txtsim");
        TextBox callfeature = (TextBox)DetailsView1.FindControl("txtcallfeat");
        TextBox cpu = (TextBox)DetailsView1.FindControl("txtcpu");
        TextBox os = (TextBox)DetailsView1.FindControl("txtos");
        TextBox ram = (TextBox)DetailsView1.FindControl("txtram");
        DropDownList java = (DropDownList)DetailsView1.FindControl("ddljava");
        TextBox processer = (TextBox)DetailsView1.FindControl("txtprocesser");
        TextBox size = (TextBox)DetailsView1.FindControl("txtdsize");
        TextBox frontcamera = (TextBox)DetailsView1.FindControl("txtfrontcamera");
        DropDownList bluethooth = (DropDownList)DetailsView1.FindControl("ddlbluethooth");
        DropDownList wifi = (DropDownList)DetailsView1.FindControl("ddlwifi");
        DropDownList _2g = (DropDownList)DetailsView1.FindControl("ddl2g");
        DropDownList _3g = (DropDownList)DetailsView1.FindControl("ddl3g");
        DropDownList gprs = (DropDownList)DetailsView1.FindControl("ddlgprs");
        TextBox backcamera = (TextBox)DetailsView1.FindControl("txtbackcamera");
        TextBox internalmemory = (TextBox)DetailsView1.FindControl("txtinternalmemory");
        TextBox externalmemory = (TextBox)DetailsView1.FindControl("txtextrnalmemory");
        TextBox weight = (TextBox)DetailsView1.FindControl("txtweight");
        TextBox batterytype = (TextBox)DetailsView1.FindControl("txtbattry");

        if (filefrontimage.HasFile && filebackimage.HasFile)
        {
            tbl_product proObj = new tbl_product();

            string serverpath = Server.MapPath("..") + "\\img\\" + filefrontimage.FileName;
            filefrontimage.SaveAs(serverpath);
            string urlfront = filefrontimage.FileName;

            string serverpath1 = Server.MapPath("..") + "\\img\\" + filebackimage.FileName;
            filebackimage.SaveAs(serverpath);
            string urlback = filebackimage.FileName;

            proObj = db.tbl_products.Single(data => data.pkprodid == int.Parse(DetailsView1.DataKey[0].ToString()));
            proObj.prodname = ProductName.Text;
            proObj.fkcomid = int.Parse(fkcomid.SelectedValue.ToString());
            proObj.fksid = int.Parse(fksid.SelectedValue.ToString());
            proObj.stock = stock.Text;
            proObj.prize = prize.Text;
            proObj.frontimage = urlfront;
            proObj.backimage = urlback;
            proObj.modalid = modelid.Text;
            proObj.modalname = modelname.Text;
            proObj.color = color.Text;
            proObj.touch = touch.SelectedValue.ToString();
            proObj.simtype = simtype.Text;
            proObj.callfeature = callfeature.Text;
            proObj.cpu = cpu.Text;
            proObj.os = os.Text;
            proObj.ram = ram.Text;
            proObj.java = java.Text;
            proObj.processer = processer.Text;
            proObj.displaysize = size.Text;
            proObj.frontcamera = frontcamera.Text;
            proObj.backcamera = backcamera.Text;
            proObj.bluethooth = bluethooth.SelectedValue.ToString();
            proObj.wifi = wifi.SelectedValue.ToString();
            proObj._2g = _2g.SelectedValue.ToString();
            proObj._3g = _3g.SelectedValue.ToString();
            proObj.gprs = gprs.SelectedValue.ToString();
            proObj.internalmemory = internalmemory.Text;
            proObj.externalmemory = externalmemory.Text;
            proObj.weight = weight.Text;
            proObj.batterytype = batterytype.Text;

            db.SubmitChanges();
            Response.Redirect("ViewMobilProduct.aspx");
        }
    }
예제 #36
0
    protected void btnUpdateLeptop_Click(object sender, EventArgs e)
    {
        TextBox ProductName = (TextBox)DetailsView3.FindControl("txtprodname");
         DropDownList fkcomid = (DropDownList)DetailsView3.FindControl("ddlselectcompany");
         DropDownList fksid = (DropDownList)DetailsView3.FindControl("ddlsubcatl");
         TextBox stock = (TextBox)DetailsView3.FindControl("txtstock");
         TextBox prize = (TextBox)DetailsView3.FindControl("txtprize");
         FileUpload filefrontimage = (FileUpload)DetailsView3.FindControl("filefrontimage");
         TextBox modelid = (TextBox)DetailsView3.FindControl("txtmodelid");
         TextBox modelname = (TextBox)DetailsView3.FindControl("txtmodelname");
         TextBox color = (TextBox)DetailsView3.FindControl("txtcolor");
         TextBox processername = (TextBox)DetailsView3.FindControl("txtprocessername");
         TextBox harddisk = (TextBox)DetailsView3.FindControl("txtharddisk");
         TextBox os = (TextBox)DetailsView3.FindControl("txtos");
         TextBox ram = (TextBox)DetailsView3.FindControl("txtram");
         TextBox weight = (TextBox)DetailsView3.FindControl("txtweight");
         TextBox graphicsprocesser = (TextBox)DetailsView3.FindControl("txtgraphicprocesser");
         TextBox batterycell = (TextBox)DetailsView3.FindControl("txtbattterycell");
         TextBox speaker = (TextBox)DetailsView3.FindControl("txtspeakers");
         DropDownList bluethooth = (DropDownList)DetailsView3.FindControl("ddlblueth");
         DropDownList wifi = (DropDownList)DetailsView3.FindControl("ddlwifi");

         if (filefrontimage.HasFile)
         {
             string serverpath = Server.MapPath("..") + "\\img\\" + filefrontimage.FileName;
             filefrontimage.SaveAs(serverpath);
             string urlfront = filefrontimage.FileName;

             tbl_product proObj = new tbl_product();

             proObj = db.tbl_products.Single(data => data.pkprodid == int.Parse(DetailsView3.DataKey[0].ToString()));
             proObj.prodname = ProductName.Text;
             proObj.fkcomid = int.Parse(fkcomid.SelectedValue.ToString());
             proObj.fksid = int.Parse(fksid.SelectedValue.ToString());
             proObj.stock = stock.Text;
             proObj.prize = prize.Text;
             proObj.frontimage = urlfront;
             proObj.modalid = modelid.Text;
             proObj.modalname = modelname.Text;
             proObj.color = color.Text;
             proObj.processer = processername.Text;
             proObj.harddisk = harddisk.Text;
             proObj.os = os.Text;
             proObj.ram = ram.Text;
             proObj.weight = weight.Text;
             proObj.graphicprocess = graphicsprocesser.Text;
             proObj.batterycell = batterycell.Text;
             proObj.speaker = speaker.Text;
             proObj.bluethooth = bluethooth.SelectedValue.ToString();
             proObj.wifi = wifi.SelectedValue.ToString();

             db.SubmitChanges();
             Response.Redirect("ViewLeptopProduct.aspx");
         }
    }
예제 #37
0
    protected void btnsave_Click1(object sender, EventArgs e)
    {
        TextBox ProductName = (TextBox)DetailsView2.FindControl("txtprodname");
        DropDownList fkcomid = (DropDownList)DetailsView2.FindControl("ddlselectcompany");
        TextBox stock = (TextBox)DetailsView2.FindControl("txtstock");
        DropDownList fksid = (DropDownList)DetailsView2.FindControl("ddlsubcats");
        TextBox prize = (TextBox)DetailsView2.FindControl("txtprize");
        FileUpload filefrontimage = (FileUpload)DetailsView2.FindControl("filefrontimage");
        TextBox modelid = (TextBox)DetailsView2.FindControl("txtmodelid");
        TextBox modelname = (TextBox)DetailsView2.FindControl("txtmodelname");
        TextBox color = (TextBox)DetailsView2.FindControl("txtcolor");
        TextBox processername = (TextBox)DetailsView2.FindControl("txtprocessername");
        TextBox os = (TextBox)DetailsView2.FindControl("txtos");
        TextBox ram = (TextBox)DetailsView2.FindControl("txtram");
        DropDownList java = (DropDownList)DetailsView2.FindControl("ddljava");
        TextBox processer = (TextBox)DetailsView2.FindControl("txtprocesser");
        TextBox harddisk = (TextBox)DetailsView2.FindControl("txthadrdiskcap");
        TextBox opticaldrive = (TextBox)DetailsView2.FindControl("txtopticaldrive");
        TextBox weight = (TextBox)DetailsView2.FindControl("txtweight");
        TextBox graphicsprocesser = (TextBox)DetailsView2.FindControl("txtgraphicsprocesser");
        TextBox keybord = (TextBox)DetailsView2.FindControl("txtkeybord");

        if (filefrontimage.HasFile)
        {
            tbl_product proObj = new tbl_product();

            string serverpath1 = Server.MapPath("..") + "\\img\\" + filefrontimage.FileName;
            filefrontimage.SaveAs(serverpath1);
            string urlfront1 = filefrontimage.FileName;

            proObj = db.tbl_products.Single(data => data.pkprodid == int.Parse(DetailsView2.DataKey[0].ToString()));
            proObj.prodname = ProductName.Text;
            proObj.fkcomid = int.Parse(fkcomid.SelectedValue.ToString());
            proObj.fksid = int.Parse(fksid.SelectedValue.ToString());
            proObj.stock = stock.Text;
            proObj.prize = prize.Text;
            proObj.frontimage = urlfront1;
            proObj.modalid = modelid.Text;
            proObj.modalname = modelname.Text;
            proObj.color = color.Text;
            proObj.processer = processername.Text;
            proObj.harddisk = harddisk.Text;
            proObj.os = os.Text;
            proObj.ram = ram.Text;
            proObj.java = ram.Text;
            proObj.opticaldrive = opticaldrive.Text;
            proObj.weight = weight.Text;
            proObj.graphicprocess = graphicsprocesser.Text;
            proObj.keybord = keybord.Text;

            db.SubmitChanges();
            Response.Redirect("ViewComputerProduct.aspx");
        }
    }