示例#1
0
 void btnSubmit_ServerClick(object sender, EventArgs e)
 {
     GuestFeedBack objGuestFeedBack = new GuestFeedBack();
     objGuestFeedBack.Email = txtEmail.Value.Trim();
     objGuestFeedBack.FullName = txtFullName.Value.Trim();
     objGuestFeedBack.CompanyName = txtCompanyName.Value.Trim();
     objGuestFeedBack.Address = txtAddress.Value.Trim();
     objGuestFeedBack.City = txtCity.Value.Trim();
     objGuestFeedBack.Nation = txtNation.Value.Trim();
     objGuestFeedBack.PhoneNumber = txtPhoneNumber.Value.Trim();
     objGuestFeedBack.PostalCode = txtPostalCode.Value.Trim();
     objGuestFeedBack.Subject = txtSubject.Value.Trim();
     objGuestFeedBack.Comment = txtAreaMessage.Value.Trim();
     if (blUserInterfaceProcess == null)
     {
         blUserInterfaceProcess = new BLUserInterfaceProcess();
     }
     bool bAddFeedBack =  blUserInterfaceProcess.AddFeedBack(objGuestFeedBack);
     if (bAddFeedBack)
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "MyKey", "Notify('Your message has been sent!');", true);
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(GetType(), "MyKey", "Notify('Failed. Check your connection!');", true);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (blUserInterfaceProcess == null)
         {
             blUserInterfaceProcess = new BLUserInterfaceProcess();
         }
         int iCategoryID = Convert.ToInt32(Request.QueryString["CategoryID"]);
         string sCategoryName = Request.QueryString["CategoryName"];
         divCenterContent.InnerHtml += "<div class='center_title_bar'>" + sCategoryName + "</div>";
         List<Product> listOfProduct = blUserInterfaceProcess.GetProductByCategory(iCategoryID);
         foreach (Product obj in listOfProduct)
         {
             divCenterContent.InnerHtml += "<div class='prod_box'>" +
                                            "<div class='center_prod_box'>" +
                                                "<div class='product_title'><a href='ProductDetails.aspx?ProductID=" + obj.ProductID + "'>" + obj.ProductName + "</a></div>" +
                                                "<div class='product_img'><a href='ProductDetails.aspx?ProductID=" + obj.ProductID + "'><img src='../" + obj.Picture + "' alt='' width='91' height='71' /></a></div>" +
                                                "<div class='prod_price'><span class='price'>" + Math.Round(obj.UnitPrice, 1) + " $</span></div>" +
                                            "</div>" +
                                            "<div class='prod_details_tab'> <a href='ProductDetails.aspx?ProductID=" + obj.ProductID + "' class='prod_details'>Details</a> </div>" +
                                            "</div>";
         }
     }
 }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (blUserInterfaceProcess == null)
            {
                blUserInterfaceProcess = new BLUserInterfaceProcess();
            }
            if (!IsPostBack)
            {
                // Find controls in master page
                //int sLogin = Convert.ToInt32( Request.QueryString["PageLogin"]);
                //if (sLogin==1)
                //{
                //    HtmlAnchor aLogin = (HtmlAnchor)Master.FindControl("aLogin");
                //    HtmlAnchor aSignUp = (HtmlAnchor)Master.FindControl("aSignUp");
                //    HtmlGenericControl divLogin = (HtmlGenericControl)Master.FindControl("divLogin");

                //    aLogin.Visible = false;
                //    aSignUp.Visible = false;
                //    Label lblUserName = new Label();
                //    lblUserName.Text = "aaa";
                //    divLogin.Controls.Add(lblUserName);
                //    divLogin.InnerHtml = "<a href='Login.aspx' class='login'>Log out</a>";
                //}

                // Load products from database to my page
                divCenterContent.InnerHtml += "<div class='center_title_bar'>Latest Products</div>";
                List<Product> listOfProduct = blUserInterfaceProcess.GetProductByAddedDate();
                foreach (Product obj in listOfProduct)
                {
                    divCenterContent.InnerHtml += "<div class='prod_box'>" +
                                                    "<div class='center_prod_box'>" +
                                                        "<div class='product_title'><a href='ProductDetails.aspx?ProductID=" + obj.ProductID + "'>" + obj.ProductName + "</a></div>" +
                                                        "<div class='product_img'><a href='ProductDetails.aspx?ProductID=" + obj.ProductID + "'><img src='../"+obj.Picture+"' alt='' width='91' height='71' /></a></div>" +
                                                        "<div class='prod_price'><span class='price'>" +Math.Round( obj.UnitPrice,1) + " $</span></div>" +
                                                    "</div>" +
                                                    "<div class='prod_details_tab'> <a href='ProductDetails.aspx?ProductID=" + obj.ProductID + "' class='prod_details'>Details</a> </div>" +
                                                    "</div>";
                }
                divCenterContent.InnerHtml += "<div class='center_title_bar'> Recommended Product </div>";
                List<Product> listOfProductByMostFrequentlyViewed = blUserInterfaceProcess.GetProductByMostFrequentlyViewed();
                foreach (Product obj in listOfProductByMostFrequentlyViewed)
                {
                    divCenterContent.InnerHtml += "<div class='prod_box'>" +
                                                   "<div class='center_prod_box'>" +
                                                       "<div class='product_title'><a href='ProductDetails.aspx?ProductID=" + obj.ProductID + "'>" + obj.ProductName + "</a></div>" +
                                                       "<div class='product_img'><a href='ProductDetails.aspx?ProductID=" + obj.ProductID + "'><img src='../" + obj.Picture + "' alt='' width='91' height='71' /></a></div>" +
                                                       "<div class='prod_price'><span class='price'>" + Math.Round( obj.UnitPrice,1) + " $</span></div>" +
                                                   "</div>" +
                                                   "<div class='prod_details_tab'> <a href='ProductDetails.aspx?ProductID=" + obj.ProductID + "' class='prod_details'>Details</a> </div>" +
                                                   "</div>";
                }
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["userName"] != null)
                {
                    divUserName.Visible = true;
                    divLogin.Visible = false;
                    lblUserName.InnerText = "Hi "+ Session["userName"].ToString() +"!";
                    lblUserName.Visible = true;
                }
                else
                {
                    divLogin.Visible = true;
                    divUserName.Visible = false;
                }
                // Load all categories from database to my page
                if (blUserInterfaceProcess == null)
                {
                    blUserInterfaceProcess = new BLUserInterfaceProcess();
                }
                List<Category> ListOfCategory = blUserInterfaceProcess.GetAllCategory();
                int i = 0;
                foreach (Category obj in ListOfCategory)
                {
                    int iCategoryID = obj.CategoryID;
                    string sCategoryName = obj.CategoryName;
                    if (i % 2 == 0)
                    {
                        ulCategory.InnerHtml += "<li class='even'><a href='ShowProductByCategory.aspx?CategoryID=" + iCategoryID + "&CategoryName=" + sCategoryName + "'>" + sCategoryName + "</a></li>";
                        i++;
                    }
                    else
                    {
                        ulCategory.InnerHtml += "<li class='odd'><a href='ShowProductByCategory.aspx?CategoryID=" + iCategoryID + "&CategoryName=" + sCategoryName + "'>" + sCategoryName + "</a></li>";
                        i++;
                    }
                }

            }
        }
示例#5
0
 void btnLogin_ServerClick(object sender, EventArgs e)
 {
     string sEmail = txtEmail.Value.Trim();
     string sPassword = txtPassword.Value.Trim();
     if (blUserInterfaceProcess == null)
     {
         blUserInterfaceProcess = new BLUserInterfaceProcess();
     }
     Careerer objCareerer = blUserInterfaceProcess.Login(sEmail, sPassword);
     if (objCareerer != null)
     {
         lblError.Visible = false;
         Session["userName"] = objCareerer.UserName;
         Session["CareererID"] = objCareerer.CareererID;
         //Page.ClientScript.RegisterStartupScript(GetType(), "MyKey", "Notify('Log in is SUCCESS! ');", true);
         Response.Redirect("Index.aspx");
     }
     else
     {
         lblError.Visible = true;
     }
 }
示例#6
0
 void btnSignUp_ServerClick(object sender, EventArgs e)
 {
     string sEmail = txtEmail.Value.Trim();
     string sPassword = txtPassword.Value.Trim();
     string sUserName = txtName.Value.Trim();
     if (blUserInterfaceProcess == null)
     {
         blUserInterfaceProcess = new BLUserInterfaceProcess();
     }
     bool bSignUpSuccess = blUserInterfaceProcess.SignUp(sEmail, sPassword, sUserName);
     if (bSignUpSuccess)
     {
         ClientScriptManager CSM = Page.ClientScript;
         if (!ReturnValue())
         {
             string strconfirm = "<script>if(window.confirm('Your account has been registered!Do you wanna log in now')){window.location.href='Login.aspx'}</script>";
             CSM.RegisterClientScriptBlock(this.GetType(),"Confirm", strconfirm, false);
         }
     }
     else
     {
         lblSignUpError.Visible = true;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int iProductID = Convert.ToInt32(Request.QueryString["ProductID"]);
                if (blUserInterfaceProcess == null)
                {
                    blUserInterfaceProcess = new BLUserInterfaceProcess();
                }
                Product objProduct = blUserInterfaceProcess.GetDetailProduct(iProductID);
                DataTable dtDetailProduct = new DataTable();
                dtDetailProduct.Columns.Add("Properties");
                dtDetailProduct.Columns.Add("Value");
                dtDetailProduct.Rows.Add("Name", objProduct.ProductName);
                dtDetailProduct.Rows.Add("Output", objProduct.Output +" products/h");
                dtDetailProduct.Rows.Add("Made Goods Size", objProduct.MadeGoodsSize+" mm");
                dtDetailProduct.Rows.Add("Machine Size", objProduct.MachineSize + " mm");
                dtDetailProduct.Rows.Add("Weight", objProduct.Weight +" kg");
                dtDetailProduct.Rows.Add("Viewed", objProduct.FrequentlyViewed);
                string sExtraDescription = objProduct.ExtraDescription;
                string[] sDescriptions = sExtraDescription.Split(',');
                for(int i=0;i<sDescriptions.Length;i++)
                {
                    string[] sSplitMedium = sDescriptions[i].Split(':');
                    dtDetailProduct.Rows.Add(sSplitMedium[0], sSplitMedium[1]);
                }
                // Display product details
                title.InnerText = objProduct.ProductName;
                divDetailPrice.InnerHtml = Math.Round(objProduct.UnitPrice, 1).ToString();
                imgProduct.ImageUrl ="~/"+ objProduct.Picture;
                divDetailPrice.InnerText = objProduct.UnitPrice.ToString();
                gvDetailProduct.DataSource = dtDetailProduct;
                gvDetailProduct.DataBind();

            }
        }