Ejemplo n.º 1
0
 public int save(bal.Category o)
 {
     sqlcmd = con.dbCommand("category_save");
     sqlcmd.Parameters.AddWithValue("@catid", o.catid);
     sqlcmd.Parameters.AddWithValue("@categoryname", o.categoryname);
     return(sqlcmd.ExecuteNonQuery());
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bal.Category obj = new bal.Category();

                if (Request.QueryString["catid"] == null)
                {
                    GridView1.DataSource = obj.list();
                    GridView1.DataBind();
                }
                else
                {
                    obj.catid = Int32.Parse(Request.QueryString["catid"].ToString());

                    if (obj.remove() > 0)
                    {
                        Response.Redirect("~/admin/categorylist.aspx");
                    }
                    else
                    {
                        Response.Write("Data couldnot Removed !!");
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (list.Count <= 0)
                {
                    bal.Recipes obj = new bal.Recipes();
                    list = obj.list();
                }
                //BannerImage.ImageUrl = "~/images/" + list[0].image;
                Literal1.Text = "<div style='background-image : url(/images/" + list[0].image + ");height:300px;width:1000px'>" +
                                " </div>";


                bal.Category        cobj  = new bal.Category();
                List <bal.Category> cList = new List <bal.Category>();
                cList = cobj.list();

                String CategoryList = String.Empty;
                for (int i = 0; i < cList.Count; i++)
                {
                    CategoryList += "<div id='downContent'>" +
                                    "<div id='downMenu'>" +
                                    "<a href='menuitemlist.aspx?catid=" + cList[i].catid + "'>" + cList[i].categoryname + " </a> " +
                                    "</div>" +

                                    " <div id='downImage'> <img src='images/" + cList[i].image + "' alt=' " + cList[i].categoryname + "'/>  </div>" +

                                    "</div>";
                }

                Literal2.Text = CategoryList;
            }
        }
Ejemplo n.º 4
0
 void dList(DataTable dt)
 {
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         bal.Category c = new bal.Category();
         c.catid        = Int32.Parse(dt.Rows[i]["catid"].ToString());
         c.categoryname = dt.Rows[i]["categoryname"].ToString();
         cList.Add(c);
     }
 }
Ejemplo n.º 5
0
        public List <bal.Category> get(bal.Category o)
        {
            sqlcmd = con.dbCommand("category_get");
            sqlcmd.Parameters.AddWithValue("@catid", o.catid);
            SqlDataReader sqldr = sqlcmd.ExecuteReader();
            DataTable     dt    = new DataTable();

            dt.Load(sqldr);
            dList(dt);

            return(cList);
        }
Ejemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["catid"] != null)
     {
         bal.Category obj = new bal.Category();
         obj.catid = Int32.Parse(Request.QueryString["catid"].ToString());
         List <bal.Category> list = obj.get();
         txt_categoryname.Text = list[0].categoryname;
     }
     else
     {
         clearFields();
     }
 }
Ejemplo n.º 7
0
        protected void btn_login_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (fu_picture.HasFile)
                {
                    string ext = Path.GetExtension(fu_picture.PostedFile.FileName);
                    if (ext == ".jpg" || ext == ".png" || ext == ".gif")
                    {
                        fu_picture.SaveAs(MapPath("~/images/" + fu_picture.PostedFile.FileName));

                        System.Drawing.Image objImage = System.Drawing.Image.FromFile(MapPath("~/images/" + fu_picture.PostedFile.FileName));
                        int width  = objImage.Width;
                        int height = objImage.Height;

                        if (width != 1000 && height != 300)
                        {
                            Response.Write("width and height must be 1000 and 300 pixel !!!");
                            return;
                        }
                    }
                    else
                    {
                        Response.Write("Only .JPG or .PNG formate is accepted !!!");
                        return;
                    }
                }
                bal.Recipes obj = new bal.Recipes();
                obj.recipeid   = Request.QueryString["recipeid"] == null ? 0 : Int32.Parse(Request.QueryString["recipeid"].ToString());
                obj.recipename = txt_menuitem.Text;
                obj.recipedesc = txt_menuitemdescription.Text;
                obj.price      = Int32.Parse(txt_price.Text);
                obj.image      = fu_picture.PostedFile.FileName;
                bal.Category o = new bal.Category();
                o.categoryname = dd_menucateogry.SelectedItem.Text;
                o.catid        = Int32.Parse(dd_menucateogry.SelectedItem.Value);
                obj.category   = o;// = Int32.Parse(dd_menucateogry.SelectedItem.Value.ToString());

                if (obj.save() > 0)
                {
                    Response.Redirect("~/admin/menuitemlist.aspx");
                }
                else
                {
                }
            }
        }
Ejemplo n.º 8
0
        protected void btn_login_Click(object sender, EventArgs e)
        {
            bal.Category obj = new bal.Category();

            obj.catid = Request.QueryString["catid"] == null ? 0 : Int32.Parse(Request.QueryString["catid"].ToString());

            obj.categoryname = txt_categoryname.Text;

            if (obj.save() > 0)
            {
                Response.Redirect("~/admin/categorylist.aspx");
            }
            else
            {
                Response.Write("Could not Saved !!!");
            }
        }
Ejemplo n.º 9
0
        protected void btn_login_Click(object sender, EventArgs e)
        {
            bal.Category obj = new bal.Category();

            obj.catid = Request.QueryString["catid"] == null ? 0 : Int32.Parse(Request.QueryString["catid"].ToString());

            obj.categoryname = txt_categoryname.Text;

            if (fu_picture.HasFile)
            {
                string ext = Path.GetExtension(fu_picture.PostedFile.FileName);
                if (ext == ".jpg" || ext == ".png" || ext == ".gif")
                {
                    fu_picture.SaveAs(MapPath("~/images/" + fu_picture.PostedFile.FileName));

                    System.Drawing.Image objImage = System.Drawing.Image.FromFile(MapPath("~/images/" + fu_picture.PostedFile.FileName));
                    int width  = objImage.Width;
                    int height = objImage.Height;

                    if (width != 320 && height != 200)
                    {
                        Response.Write("width and height must be 320 and 200 pixel !!!");
                        return;
                    }
                }
                else
                {
                    Response.Write("Only .JPG or .PNG formate is accepted !!!");
                    return;
                }
            }
            obj.image = fu_picture.PostedFile.FileName;
            if (obj.save() > 0)
            {
                Response.Redirect("~/admin/categorylist.aspx");
            }
            else
            {
                Response.Write("Could not Saved !!!");
            }
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                bal.Category objcat = new bal.Category();
                dd_menucateogry.DataSource = objcat.list();
                dd_menucateogry.DataBind();
                dd_menucateogry.DataTextField  = "categoryname";
                dd_menucateogry.DataValueField = "catid";

                if (Request.QueryString["recipeid"] != null)
                {
                    bal.Recipes obj = new bal.Recipes();
                    obj.recipeid = Int32.Parse(Request.QueryString["recipeid"].ToString());
                    List <bal.Recipes> list = obj.get();

                    txt_menuitem.Text            = list[0].recipename;
                    txt_menuitemdescription.Text = list[0].recipedesc;
                    txt_price.Text = list[0].price.ToString();
                    dd_menucateogry.SelectedValue = list[0].category.catid.ToString();
                }
            }
        }
Ejemplo n.º 11
0
        void dList(DataTable dt)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                bal.Recipes c = new bal.Recipes();
                c.recipeid   = Int32.Parse(dt.Rows[i]["catid"].ToString());
                c.recipename = dt.Rows[i]["recipename"].ToString();
                c.recipedesc = dt.Rows[i]["recipedesc"].ToString();
                c.price      = Int32.Parse(dt.Rows[i]["price"].ToString());
                //c.catid = Int32.Parse(dt.Rows[i]["catid"].ToString());
                c.image = dt.Rows[i]["image"].ToString();

                bal.Category cat = new bal.Category();
                cat.catid        = Int32.Parse(dt.Rows[i]["catid"].ToString());
                cat.categoryname = dt.Rows[i]["categoryname"].ToString();
                c.category       = cat;

                Commentdb combdb = new Commentdb();
                c.commentList = combdb.getbyrecipe(c.recipeid);

                cList.Add(c);
            }
        }