protected void Button1_Click(object sender, EventArgs e)
        {
            int er = 0;

            lblMessage.Text = "";

            if (txtProductName.Text == "")
            {
                er++;
                RequiredFieldValidator1.Text = "Required";
            }
            if (txtProductPrice.Text == "")
            {
                er++;
                RequiredFieldValidator3.Text = "Required";
            }
            if (er > 0)
            {
                return;
            }

            DAL.product p = new DAL.product();
            p.Name         = txtProductName.Text;
            p.Descriptioin = txtProductDescription.Text;
            p.CategoryId   = Convert.ToInt32(ddlProduct.SelectedItem.Value);
            p.price        = Convert.ToDouble(txtProductPrice.Text);
            p.Image        = System.IO.Path.GetFileName(fileImg.FileName);

            if (p.Insert())
            {
                lblMessage.Text      = "Data Inserted";
                lblMessage.ForeColor = System.Drawing.Color.Green;

                fileImg.SaveAs(Server.MapPath("uploads/productImages/" + p.Image));
            }
            else
            {
                lblMessage.Text      = p.Error;
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
Beispiel #2
0
        //


        public int num_cateid(int cateid)
        {
            DAL.product dal = new DAL.product();
            return(dal.num_cateid(cateid));
        }
Beispiel #3
0
 public DataSet p_dataset(int cateid, int pageindex, int pagesize, string table)
 {
     DAL.product dal = new DAL.product();
     return(dal.p_dateset(cateid, pageindex, pagesize, table));
 }
Beispiel #4
0
 public SqlDataReader drpr(Model.product aa)
 {
     DAL.product dalps = new DAL.product();
     return(dalps.drpr(aa));
 }
Beispiel #5
0
 public SqlDataReader drim(Model.product aa)
 {
     DAL.product dalpdd = new DAL.product();
     return(dalpdd.drima(aa));
 }
Beispiel #6
0
 public int update(Model.product mym)
 {
     DAL.product dal = new DAL.product();
     return(dal.update(mym));
 }
Beispiel #7
0
        //

        public DataSet drpo(Model.product aa)
        {
            DAL.product dalp = new DAL.product();
            return(dalp.drpo(aa));
        }
Beispiel #8
0
 public string select_imageid(Model.product mym)
 {
     DAL.product dal = new DAL.product();
     return(dal.select_imageid(mym));
 }
Beispiel #9
0
 public SqlDataReader selectupdate(int mym)
 {
     DAL.product dal = new DAL.product();
     return(dal.selectupdate(mym));
 }
Beispiel #10
0
 public DataSet select_title(Model.product mym)
 {
     DAL.product dal = new DAL.product();
     return(dal.select_title(mym));
 }
Beispiel #11
0
 public int delete_id(Model.product mym)
 {
     DAL.product dal = new DAL.product();
     return(dal.delete_id(mym));
 }
Beispiel #12
0
 public DataSet dataset()
 {
     DAL.product dal = new DAL.product();
     return(dal.dataset());
 }
Beispiel #13
0
 public int insert(Model.product mym)
 {
     DAL.product dal = new DAL.product();
     return(dal.Insert(mym));
 }
Beispiel #14
0
 public product()
 {
     dal = new DAL.product("fg_");
 }