protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if ((Request.QueryString["cid"] != null && !string.IsNullOrEmpty(Request.QueryString["cid"]))) { uiPanelProducts.Visible = true; uiPanelCats.Visible = false; BindProducts(); } else { uiPanelProducts.Visible = false; uiPanelCats.Visible = true; DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetAllCats(); uiRepeaterCats.DataSource = ds; uiRepeaterCats.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["NID"] != null && !string.IsNullOrEmpty(Request.QueryString["NID"])) { uiPanelAll.Visible = false; uiPanelDetails.Visible = true; int id = Convert.ToInt32(Request.QueryString["NID"].ToString()); DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetNewsContent(id); uiLabelTitle.Text = ds.Tables[0].Rows[0]["Title"].ToString(); uiImagemain.ImageUrl = ds.Tables[0].Rows[0]["MainPicURL"].ToString(); uiLiteralContent.Text = Server.HtmlDecode( ds.Tables[0].Rows[0]["Content"].ToString()); newImages.DataSource = db.GetNewsImages(id); newImages.DataBind(); } else { uiPanelAll.Visible = true; uiPanelDetails.Visible = false; BindData(); } } }
protected void uiGridViewImages_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteItem") { DBLayer db = new DBLayer(); db.DeleteNewsImagesByID(Convert.ToInt32(e.CommandArgument)); BindImages(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["view"] != null && !string.IsNullOrEmpty(Request.QueryString["view"])) { if (Request.QueryString["view"].ToString() == "f") { DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetAllContactByType(2); uiLiteralFactScript.Text = "<script type='text/javascript'>function initializeFact() {var latlng = new google.maps.LatLng(" + ds.Tables[0].Rows[0]["latitude"].ToString() + ", " + ds.Tables[0].Rows[0]["longitude"].ToString() + ");var myOptions = {zoom: 16,center: latlng};var map = new google.maps.Map(document.getElementById('map_canvas'),myOptions); var marker = new google.maps.Marker({position: latlng,map: map,title:'Factory'});}</script>"; uiLiteralFactoryContent.Text = ds.Tables[0].Rows[0]["Content"].ToString(); FMail.Text = ds.Tables[0].Rows[0]["email"].ToString(); FMail.NavigateUrl = "mailto:" + ds.Tables[0].Rows[0]["email"].ToString(); uiPanelFactory.Visible = true; } else if (Request.QueryString["view"].ToString() == "ho") { DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetAllContactByType(1); uiLiteralHOscript.Text = "<script type='text/javascript'>function initializeHead() {var latlng = new google.maps.LatLng(" + ds.Tables[0].Rows[0]["latitude"].ToString() + ", " + ds.Tables[0].Rows[0]["longitude"].ToString() + ");var myOptions = {zoom: 16,center: latlng};var map = new google.maps.Map(document.getElementById('map_canvas'),myOptions); var marker = new google.maps.Marker({position: latlng,map: map,title:'Head office'});}</script>"; uiLiteralHOContent.Text = ds.Tables[0].Rows[0]["Content"].ToString(); HOMail.Text = ds.Tables[0].Rows[0]["email"].ToString(); HOMail.NavigateUrl = "mailto:" + ds.Tables[0].Rows[0]["email"].ToString(); uiPanelHO.Visible = true; } else if (Request.QueryString["view"].ToString() == "s") { DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetAllContactByType(3); uiRepeaterRooms.DataSource = ds; uiRepeaterRooms.DataBind(); uiPanelShowrooms.Visible = true; /* uiLiteralHOscript.Text = "<script type='text/javascript'>function initializeHead() {var latlng = new google.maps.LatLng(" + ds.Tables[0].Rows[0]["latitude"].ToString() + ", " + ds.Tables[0].Rows[0]["longitude"].ToString() + ");var myOptions = {zoom: 16,center: latlng};var map = new google.maps.Map(document.getElementById('map_canvas'),myOptions);}</script>"; uiLiteralHOContent.Text = ds.Tables[0].Rows[0]["Content"].ToString(); */ } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if ((Request.QueryString["cid"] != null && !string.IsNullOrEmpty(Request.QueryString["cid"]))) { uiPanelProducts.Visible = true; uiPanelDetail.Visible = false; uiPanelCats.Visible = false; BindProducts(); } if ((Request.QueryString["pid"] != null && !string.IsNullOrEmpty(Request.QueryString["pid"]))) { uiPanelProducts.Visible = false; uiPanelDetail.Visible = true; uiPanelCats.Visible = false; DBLayer db = new DBLayer(); DataSet ds = new DataSet(); DataSet items = new DataSet(); ds = db.GetProductContent(Convert.ToInt32(Request.QueryString["pid"].ToString())); items = db.GetAllItemsByProductID(Convert.ToInt32(Request.QueryString["pid"].ToString())); uiLabelPath.Text = db.GetCategoryContent(Convert.ToInt32(ds.Tables[0].Rows[0]["CategoryID"].ToString())).Tables[0].Rows[0]["categoryName"].ToString() + " / " + ds.Tables[0].Rows[0]["ProductName"].ToString(); uiImagemainPic.ImageUrl = ds.Tables[0].Rows[0]["PicPath"].ToString(); uiLabelDesigner.Text = "Designer : " + ds.Tables[0].Rows[0]["DesignerName"].ToString(); backlink.NavigateUrl = "?cid=" + ds.Tables[0].Rows[0]["CategoryID"].ToString(); uiRepeaterItems.DataSource = items; uiRepeaterItems.DataBind(); } else if ((Request.QueryString["cid"] == null || string.IsNullOrEmpty(Request.QueryString["cid"])) && (Request.QueryString["pid"] == null || string.IsNullOrEmpty(Request.QueryString["pid"]))) { uiPanelProducts.Visible = false; uiPanelDetail.Visible = false; uiPanelCats.Visible = true; DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetAllCats(); uiRepeaterCats.DataSource = ds; uiRepeaterCats.DataBind(); } } }
private void BindData() { PagedDataSource dt = new PagedDataSource(); DBLayer db = new DBLayer(); dt.DataSource = db.GetAllNews().Tables[0].DefaultView; dt.AllowPaging = true; dt.PageSize = 10; dt.CurrentPageIndex = PageIndex; uiRepeaterNews.DataSource = dt; uiRepeaterNews.DataBind(); uiLinkButtonPrev.Enabled = !dt.IsFirstPage; uiLinkButtonNext.Enabled = !dt.IsLastPage; uiLabelPages.Text = "Page " + (PageIndex + 1).ToString() + " of " + dt.PageCount.ToString() + " Pages"; }
private void BindProducts() { DBLayer db = new DBLayer(); DataSet ds = new DataSet(); DataSet ds2 = new DataSet(); ds = db.GetAllProductByCatID(Convert.ToInt32(Request.QueryString["cid"].ToString())); ds2 = db.GetCategoryContent(Convert.ToInt32(Request.QueryString["cid"].ToString())); uiLabelCategory.Text = ds2.Tables[0].Rows[0]["CategoryName"].ToString(); PagedDataSource dt = new PagedDataSource(); dt.DataSource = ds.Tables[0].DefaultView; dt.AllowPaging = true; dt.PageSize = 12; dt.CurrentPageIndex = PageIndex; uiLinkButtonPrev.Enabled = !dt.IsFirstPage; uiLinkButtonNext.Enabled = !dt.IsLastPage; uiLabelPages.Text = "Page " + (PageIndex + 1).ToString() + " of " + dt.PageCount.ToString() + " Pages"; uiRepeaterProducts.DataSource = dt; uiRepeaterProducts.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["PID"] != null && !string.IsNullOrEmpty(Request.QueryString["PID"].ToString())) { int id = Convert.ToInt32(Request.QueryString["PID"].ToString()); DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetPageContent(id); if (ds.Tables[0].Rows.Count != 0) { uiImagemain.ImageUrl = ds.Tables[0].Rows[0]["ImageBanner"].ToString(); uiLabelcontent.Text = Server.HtmlDecode(ds.Tables[0].Rows[0]["Content"].ToString()); } else { Response.Redirect("Page.aspx?PID=2"); } } else { Response.Redirect("Page.aspx?PID=2"); } }
private void BindDesigners() { if (Request.QueryString["did"] == null || string.IsNullOrEmpty(Request.QueryString["did"].ToString())) { DBLayer db = new DBLayer(); uiRepeaterDesigners.DataSource = db.GetAllDesigners(); uiRepeaterDesigners.DataBind(); uiPanelAll.Visible = true; uiPanelDetails.Visible = false; } else { uiPanelAll.Visible = false; uiPanelDetails.Visible = true; DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetDesignerContent(Convert.ToInt32(Request.QueryString["did"].ToString())); uiImagemain.ImageUrl = ds.Tables[0].Rows[0]["MainPic"].ToString(); uiLabelName.Text = ds.Tables[0].Rows[0]["DesignerName"].ToString(); uiLabelTitle.Text = ds.Tables[0].Rows[0]["Title"].ToString(); uiLiteralContent.Text = Server.HtmlDecode(ds.Tables[0].Rows[0]["Content"].ToString()); } }
protected void uiGridViewNews_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditNews") { DBLayer db = new DBLayer(); CurrentNews = Convert.ToInt32(e.CommandArgument); DataSet ds = db.GetNewsContent(CurrentNews); uiTextBoxTitle.Text = ds.Tables[0].Rows[0]["Title"].ToString(); uiTextBoxBrief.Text = ds.Tables[0].Rows[0]["Brief"].ToString(); uiTextBoxDate.Text = string.Format("{0:dd/MM/yyyy}",ds.Tables[0].Rows[0]["NewsDate"]); uiTextBoxContent.Text = ds.Tables[0].Rows[0]["Content"].ToString(); uiPanelViewNews.Visible = false; uiPanelEdit.Visible = true; BindImages(); } else if (e.CommandName == "DeleteNews") { DBLayer db = new DBLayer(); db.DeleteNewsImages(Convert.ToInt32(e.CommandArgument)); db.DeleteNews(Convert.ToInt32(e.CommandArgument)); CurrentNews = 0; BindData(); } }
private void UpdateRecord() { DBLayer db = new DBLayer(); string filepath = ""; if (uiFileUploadMainPicturePath.HasFile) { uiFileUploadMainPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/News/" + uiFileUploadMainPicturePath.FileName)); filepath = "/UploadedFiles/News/" + uiFileUploadMainPicturePath.FileName; } db.SetNewsContent(CurrentNews, uiTextBoxContent.Text, uiTextBoxTitle.Text, uiTextBoxBrief.Text, DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null), filepath); }
private void BindImages() { DBLayer db = new DBLayer(); uiGridViewImages.DataSource = db.GetNewsImages(CurrentNews); uiGridViewImages.DataBind(); }
private void BindData() { DBLayer db = new DBLayer(); uiGridViewNews.DataSource = db.GetAllNews(); uiGridViewNews.DataBind(); }
protected void uiLinkButtonAddItems_Click(object sender, EventArgs e) { DBLayer db = new DBLayer(); string filepath = ""; if (uiFileUploadImage.HasFile) { uiFileUploadImage.SaveAs(Server.MapPath("~/UploadedFiles/News/" + uiFileUploadImage.FileName)); filepath = "/UploadedFiles/News/" + uiFileUploadImage.FileName; } db.AddNewsImages(filepath, CurrentNews); BindImages(); }