protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bal.Recipes obj = new bal.Recipes();

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

                    if (obj.remove() > 0)
                    {
                        Response.Redirect("~/admin/menuitemlist.aspx");
                    }
                    else
                    {
                        Response.Write("Data couldnot Removed !!");
                    }
                }
            }
        }
        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;
            }
        }
        protected void btn_login_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (fu_picture.HasFile)
                {
                    fu_picture.SaveAs(MapPath("~/image/" + fu_picture.PostedFile.FileName));
                }
                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;
                obj.category.catid = Int32.Parse(dd_menucateogry.SelectedValue.ToString());

                if (obj.save() > 0)
                {
                    Response.Redirect("~/admin/menuitemlist.aspx");
                }
                else
                {
                }
            }
        }
Beispiel #4
0
 public int save(bal.Recipes o)
 {
     sqlcmd = con.dbCommand("recipe_save");
     sqlcmd.Parameters.AddWithValue("@recipeid", o.recipeid);
     sqlcmd.Parameters.AddWithValue("@recipename", o.recipename);
     sqlcmd.Parameters.AddWithValue("@catid", o.category.catid);
     sqlcmd.Parameters.AddWithValue("@price", o.price);
     sqlcmd.Parameters.AddWithValue("@image", o.image);
     return(sqlcmd.ExecuteNonQuery());
 }
Beispiel #5
0
        public List <bal.Recipes> getbyCategory(bal.Recipes o)
        {
            sqlcmd = con.dbCommand("recipe_get_bycategory");
            sqlcmd.Parameters.AddWithValue("@catid", o.catid);
            SqlDataReader sqldr = sqlcmd.ExecuteReader();
            DataTable     dt    = new DataTable();

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

            return(cList);
        }
        protected void Timer_Tick(object sender, EventArgs e)
        {
            if (list.Count <= 0)
            {
                bal.Recipes obj = new bal.Recipes();
                list = obj.list();
            }
            Random rand = new Random();
            int    i    = rand.Next(0, list.Count);

            Literal1.Text = "<div style='background-image : url(/images/" + list[i].image + ");height:300px;width:1000px'>" +
                            "</div>";
        }
Beispiel #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
                {
                }
            }
        }
Beispiel #8
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();

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

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

                cList.Add(c);
            }
        }
        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();
                }
            }
        }
Beispiel #10
0
 public int remove(bal.Recipes o)
 {
     sqlcmd = con.dbCommand("recipe_remove");
     sqlcmd.Parameters.AddWithValue("@recipeid", o.recipeid);
     return(sqlcmd.ExecuteNonQuery());
 }