예제 #1
0
        private void FillPage()
        {
            ArrayList     chocList = DatabasePull.GetDetails(Id);
            StringBuilder table    = new StringBuilder();

            foreach (Choco choco in chocList)
            {
                table.Append(string.Format(
                                 @"<table class='chocTable'>
                    <tr>
                        <th rowspan='5' width = '25px'> ID </th>
                        <th rowspan ='5' width = '25px'>{0}</th>
                        <th rowspan='5' width = '250px'><img runat='server' src='{5}' height ='200px' width ='200px'/></th>
                        <th width='50px' height='20px'>Name: </td>
                        <td height='25px'>{2}</td>
                    </tr>
                    <tr>
                        <th height='25px'>Brand:</th>
                        <td height='25px'>{1}</td>
                    </tr>
                    <tr>
                        <th height='25px'>Price:</th>
                        <td height='25px'> RM{3}</td>
                    </tr>
                    <tr>
                        <td colspan='3' width='500px'>{4}</td>
                    </tr>
                    </table>"
                                 , choco.Id, choco.brand, choco.name, choco.price, choco.desc, choco.img));

                LabelOutput.Text = table.ToString();
            }
        }
예제 #2
0
        protected void Save_Click(object sender, EventArgs e)
        {
            string     Id    = Selection.Text;
            string     brand = Brand.Text;
            string     name  = Name.Text;
            string     type  = Type.SelectedValue;
            SqlDecimal price = SqlDecimal.Parse(Price.Text);
            string     desc  = Desc.Text;

            string file = Path.GetFileName(Image.FileName);
            string img  = "Images/" + file;

            if (img == ImageText.Text || file == "")
            {
                img = ImageText.Text;
            }
            else
            {
                Image.SaveAs(Server.MapPath("~/Images/") + file);
            }

            Choco choco = new Choco(brand, name, type, price, desc, img);

            DatabasePull.EditChoco(choco, Id);
            FillPage();
            ClearTextView();
            update.Text = "Updated Sucessfully";
        }
예제 #3
0
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                string file = Path.GetFileName(Upload.FileName);
                Upload.SaveAs(Server.MapPath("~/Images/") + file);


                string     brand = Brand.Text;
                string     name  = Name.Text;
                string     type  = Type.SelectedValue;
                SqlDecimal price = SqlDecimal.Parse(Price.Text);
                string     desc  = Desc.Text;
                string     image = "Images/" + file;

                Choco choco = new Choco(brand, name, type, price, desc, image);

                DatabasePull.AddChoco(choco);
                FillPage();
                Result.Text = "Upload Success";
                ClearTextField();
            }


            catch (Exception)
            {
                Result.Text = "Upload Failed!";
            }
        }
예제 #4
0
        protected void Delete_Click(object sender, EventArgs e)
        {
            string id = Selection.Text;

            DeleteOutput.Text = DatabasePull.DeleteChoc(id);
            FillPage();
            ClearTextView();
        }
예제 #5
0
        protected void Submit_Click1(object sender, EventArgs e)
        {
            string title    = Title1.Text;
            string email    = Email.Text;
            string feedback = Feedback.Text;


            Output.Text = DatabasePull.DoInsert(title, email, feedback);
            ClearTextView();
        }
예제 #6
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            string username = Username.Text;
            string password = Password.Text;

            DatabasePull.GetCredentials(username, password);
            if (DatabasePull.GetCredentials(username, password) == true)
            {
                LabelOutput.Text = "Login successful";
                Response.Redirect("Admin.aspx");
            }

            else
            {
                LabelOutput.Text = "Wrong Username or Password , Try Again";
                Username.Text    = "";
                Password.Text    = "";
            }
        }