Esempio n. 1
0
    public void getMenu()
    {
        int Category = int.Parse(Request.QueryString["Category"]);

        if (Category > 0)
        {
            CommonClassLibrary.CommonDataSet.CategoryDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.CategoryTableAdapter().GetDataByID(Category);
            foreach (CommonClassLibrary.CommonDataSet.CategoryRow item in collection)
            {
                CommonClassLibrary.CommonDataSet.TextContentDataTable collection3 = new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().GetDataById(long.Parse(item.Name));
                foreach (CommonClassLibrary.CommonDataSet.TextContentRow item3 in collection3)
                {
                    this.Menu2_Label.Text        = item3.Thai;
                    this.BackMenu_HyperLink.Text = item3.English;
                }
                //this.Menu_Label.Text = item.Name;
                //this.Menu2_Label.Text = item.Name;
                //this.BackMenu_HyperLink.Text = item.Name;
            }
        }
        else
        {
            this.Menu2_Label.Text        = "รายการอาหารเเละเครื่องดื่มทั้งหมด";
            this.BackMenu_HyperLink.Text = "รายการอาหารเเละเครื่องดื่มทั้งหมด";
        }
    }
Esempio n. 2
0
    public void getcategorycheckbox()
    {
        string nameEn   = "";
        string nameCH   = "";
        string name     = "";
        string imageUrl = "Image/no_image_available.jpg";

        DataTable dt = new DataTable();

        dt.Columns.Add("Id");
        dt.Columns.Add("Name");
        dt.Columns.Add("ImageURL");
        dt.Columns.Add("NameEN");
        dt.Columns.Add("NameCN");
        CommonClassLibrary.CommonDataSet.CategoryDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.CategoryTableAdapter().GetDataByStatus(1);
        foreach (CommonClassLibrary.CommonDataSet.CategoryRow item in collection)
        {
            CommonClassLibrary.CommonDataSet.TextContentDataTable collection3 = new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().GetDataById(long.Parse(item.Name));
            foreach (CommonClassLibrary.CommonDataSet.TextContentRow item3 in collection3)
            {
                name   = item3.Thai;
                nameEn = item3.English;
            }
            imageUrl = item.ImageURL;
            dt.Rows.Add(item.Id, name, imageUrl, nameEn, nameCH);
        }
        this.radiobutton.DataSource     = dt;
        this.radiobutton.DataTextField  = "Name";
        this.radiobutton.DataValueField = "Id";
        this.radiobutton.DataBind();
    }
Esempio n. 3
0
    public void Showdata()
    {
        string nameEn   = "";
        string nameCH   = "";
        string name     = "";
        string imageUrl = "Image/no_image_available.jpg";
        //string detail = "";
        //string price = "";
        //string promotion = "";
        DataTable dt = new DataTable();

        dt.Columns.Add("IDProduct");
        dt.Columns.Add("Name");
        dt.Columns.Add("ImageURL");
        dt.Columns.Add("NameEN");
        CommonClassLibrary.CommonDataSet.CategoryDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.CategoryTableAdapter().GetDataByStatus(1);
        foreach (CommonClassLibrary.CommonDataSet.CategoryRow item in collection)
        {
            CommonClassLibrary.CommonDataSet.TextContentDataTable collection3 = new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().GetDataById(long.Parse(item.Name));
            foreach (CommonClassLibrary.CommonDataSet.TextContentRow item3 in collection3)
            {
                name   = item3.Thai;
                nameEn = item3.English;
            }
            imageUrl = item.ImageURL;
            dt.Rows.Add(item.Id, name, imageUrl, nameEn);
        }


        this.CategoryTa.DataSource = dt;
        this.CategoryTa.DataBind();
    }
Esempio n. 4
0
    public void getMenu()
    {
        int    Category  = int.Parse(Request.QueryString["Category"]);
        string IDProduct = Request.QueryString["IDProduct"];

        this.BackMenu_HyperLink.NavigateUrl = "~/MenuBeverage.aspx?IDProduct=" + IDProduct + "&Category=" + Category;

        CommonClassLibrary.CommonDataSet.CategoryDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.CategoryTableAdapter().GetDataByID(Category);
        foreach (CommonClassLibrary.CommonDataSet.CategoryRow item in collection)
        {
            CommonClassLibrary.CommonDataSet.TextContentDataTable collection222 = new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().GetDataById(long.Parse(item.Name));

            foreach (CommonClassLibrary.CommonDataSet.TextContentRow item222 in collection222)
            {
                this.Menu2_Label.Text        = "แก้ไข " + item222.Thai;
                this.BackMenu_HyperLink.Text = item222.Thai;
                this.Menu1_Label.Text        = "แก้ไข " + item222.Thai;
            }
        }
    }
Esempio n. 5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string img = "";

        CommonClassLibrary.CommonDataSet.CategoryDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.CategoryTableAdapter().GetDataByID(int.Parse(aaa_TextBox.Text));
        foreach (CommonClassLibrary.CommonDataSet.CategoryRow item in collection)
        {
            this.nameimage_TextBox.Text = item.ImageURL;
        }
        if (this.EditFileUpload.HasFile)
        {
            HttpPostedFile UpFileProduct = EditFileUpload.PostedFile;

            string UpFilePro = System.IO.Path.GetExtension(UpFileProduct.FileName);


            if (UpFilePro == ".jpg" || UpFilePro == ".png" || UpFilePro == ".JPG" || UpFilePro == ".PNG" || UpFilePro == ".jpeg" || UpFilePro == ".JPEG")
            {
                string imageFileName = "IMF" + "_" + DateTime.Now.ToString("ddMMyyyy-HHmmss");
                imageFileName += ".jpg";
                img            = imageFileName;
                string path = System.IO.Path.Combine(Server.MapPath("~/Image/"), imageFileName);
                // string path = System.IO.Path.Combine(Server.MapPath("D:/OWP/DigitalServicesRestaurant/ManagementWebSite/Image/"), imageFileName);
                UpFileProduct.SaveAs(path);

                new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().UpdateQueryById(editName_TextBox.Text, editNameEN_TextBox.Text, "", DateTime.Now, 1, int.Parse(Labelidname.Text));
                if (new CommonClassLibrary.CommonDataSetTableAdapters.CategoryTableAdapter().UpdateQueryimage(img, DateTime.Now, int.Parse(aaa_TextBox.Text)) == 1)
                {
                    if (nameimage_TextBox.Text != "")
                    {
                        FileInfo DeleteImage = new FileInfo(@"C:/FTP/Imilk/Image/" + nameimage_TextBox.Text);
                        DeleteImage.Delete();
                        this.SuccessLabel.Text = "แก้ไขข้อมูลสำเร็จ";
                        Response.Redirect("~/AddCategory.aspx");
                    }
                    else
                    {
                        this.SuccessLabel.Text = "แก้ไขข้อมูลสำเร็จ";
                        Response.Redirect("~/AddCategory.aspx");
                    }
                }
                else
                {
                    FileInfo DeleteImage = new FileInfo(@"C:/FTP/Imilk/Image/" + img);
                    DeleteImage.Delete();
                    this.SuccessPanel.Visible = false;
                    this.ErrorPanel.Visible   = true;
                    this.ErrorLabel.Text      = "แก้ไขข้อมูลไม่สำเร็จ";
                }
            }
            else
            {
                this.SuccessPanel.Visible = false;
                this.ErrorPanel.Visible   = true;
                this.ErrorLabel.Text      = "ไม่สามารถเพิ่มรูปภาพได้ ต้องเป็นไฟล์ .PNG , .JPG , .JPEG ";
            }
        }
        else
        {
            new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().UpdateQueryById(editName_TextBox.Text, editNameEN_TextBox.Text, "", DateTime.Now, 1, int.Parse(Labelidname.Text));
            img = nameimage_TextBox.Text;
            if (new CommonClassLibrary.CommonDataSetTableAdapters.CategoryTableAdapter().UpdateQueryimage(img, DateTime.Now, int.Parse(aaa_TextBox.Text)) == 1)
            {
                this.SuccessLabel.Text = "แก้ไขข้อมูลสำเร็จ";
                Response.Redirect("~/AddCategory.aspx");
            }
            else
            {
                this.SuccessPanel.Visible = false;
                this.ErrorPanel.Visible   = true;
                this.ErrorLabel.Text      = "แก้ไขข้อมูลไม่สำเร็จ";
            }
        }
    }
Esempio n. 6
0
    protected void CategoryTa_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        Label idlabel        = (Label)e.Item.FindControl("idLabel");
        Label imagenamelabel = (Label)e.Item.FindControl("imagenameLabel");

        this.aaa_TextBox.Text = idlabel.Text;
        string nameimageurl = "";

        if (e.CommandName == "EditBtn")
        {
            //this.getImage();
            CommonClassLibrary.CommonDataSet.CategoryDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.CategoryTableAdapter().GetDataByID(int.Parse(idlabel.Text));
            foreach (CommonClassLibrary.CommonDataSet.CategoryRow item in collection)
            {
                this.Labelidname.Text        = item.Name;
                this.Image_category.ImageUrl = "Image/" + item.ImageURL;
            }
            this.EditPanel.Visible = true;
            this.AddPanel.Visible  = false;
            this.ShowPanel.Visible = false;
            CommonClassLibrary.CommonDataSet.TextContentDataTable collection1 = new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().GetDataById(int.Parse(Labelidname.Text));
            foreach (CommonClassLibrary.CommonDataSet.TextContentRow item1 in collection1)
            {
                editName_TextBox.Text   = item1.Thai;
                editNameEN_TextBox.Text = item1.English;
            }

            this.EditPanel.Visible = true;
            this.AddPanel.Visible  = false;
            this.ShowPanel.Visible = false;
        }
        else if (e.CommandName == "DeleteBtn")
        {
            try
            {
                CommonClassLibrary.CommonDataSet.CategoryDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.CategoryTableAdapter().GetDataByID(int.Parse(idlabel.Text));
                foreach (CommonClassLibrary.CommonDataSet.CategoryRow item in collection)
                {
                    nameimageurl = item.ImageURL;
                }
                if (new CommonClassLibrary.CommonDataSetTableAdapters.CategoryTableAdapter().UpdateQueryStatus(DateTime.Now, 0, int.Parse(aaa_TextBox.Text)) == 1)
                {
                    this.SuccessPanel.Visible = true;
                    this.ErrorPanel.Visible   = false;
                    this.SuccessLabel.Text    = "ลบข้อมูลสำเร็จ";
                }
                else
                {
                    this.SuccessPanel.Visible = false;
                    this.ErrorPanel.Visible   = true;
                    this.ErrorLabel.Text      = "ลบข้อมูลไม่สำเร็จ";
                }
                this.Showdata();
            }
            catch (Exception)
            {
            }

            this.Showdata();
        }
    }