/// <summary> /// Loads Subcategory depending on Classified CategoryID /// </summary> /// <param name="intCategoryID"></param> private void Load_Subcategory(int intCategoryID) { try { using (BOC_Classifieds_ProductProfile bocClassifiedProduct = new BOC_Classifieds_ProductProfile()) { EOC_PropertyBean eocPropertyBean = new EOC_PropertyBean(); eocPropertyBean.Category_CategoryID = intCategoryID; DataTable dtSubcategory = bocClassifiedProduct.LoadRecord_ClassifiedSubCategory(eocPropertyBean); if (dtSubcategory.Rows.Count > 0) { ddlSubcategory.DataSource = dtSubcategory; ddlSubcategory.DataValueField = "SubcategoryID"; ddlSubcategory.DataTextField = "Subcategory"; ddlSubcategory.DataBind(); } else { lblSystemMessage.Text = "No Subcategory found."; } } } catch (Exception ex) { lblSystemMessage.Text = "Error: " + ex.Message; } }
/// <summary> /// Loads all Provice /// </summary> private void LoadRecord_Province() { try { using (BOC_Classifieds_ProductProfile bocProductProfile = new BOC_Classifieds_ProductProfile()) { EOC_PropertyBean eocPropertyBean = new EOC_PropertyBean(); eocPropertyBean.Country_CountryID = 18; // change this portion DataTable dt = bocProductProfile.LoadRecord_Province(eocPropertyBean); if (dt.Rows.Count > 0) { ddlLocation.Items.Clear(); ddlLocation.Items.Add(new ListItem("Select District", "-1")); ddlLocation.DataSource = dt; ddlLocation.DataValueField = "ProvinceID"; ddlLocation.DataTextField = "Province"; ddlLocation.DataBind(); } } } catch (Exception Exp) { lblSystemMessage.Text = Exp.Message.ToString(); } }
protected void btnUpload_Click(object sender, EventArgs e) { string productID = string.Empty; string imagePath = string.Empty; int intActionResult = 0; productID = Request.QueryString["PID"]; imagePath = @"ImageHolder/Classifieds/" + productID + ".jpg"; if (!string.IsNullOrEmpty(productID)) { if (UTLUtilities.IsNumeric(productID)) { if (FileUpload1.HasFile) { if (FileUpload1.PostedFile.ContentLength > 204800) { lblSystemMessage.Text = "File size must be less than 200KB."; Page.RegisterStartupScript("Validation", "<script language=\"javascript\">window.alert(\"File size must be less than 200KB.\");</script>"); return; } else { string strExtension = ""; String UploadedFile = FileUpload1.PostedFile.FileName; if (UploadedFile.Trim() == "") { btnUpload.Enabled = true; return; } int ExtractPos = UploadedFile.LastIndexOf("."); strExtension = UploadedFile.Substring(ExtractPos, UploadedFile.Length - ExtractPos); if ((strExtension.ToUpper() == ".BMP")) { Page.RegisterStartupScript("Validation", "<script language=\"javascript\">window.alert(\"Bmp format is not allowed. Please choose any other format.\");</script>"); lblSystemMessage.Text = "Bmp format is not allowed. Please choose any other format."; return; } FileUpload1.SaveAs(Server.MapPath(@"../ImageHolder/Classifieds/") + productID + ".jpg"); using (BOC_Classifieds_ProductProfile bocProductProfile = new BOC_Classifieds_ProductProfile()) { EOC_PropertyBean eocPropertyBean = new EOC_PropertyBean(); eocPropertyBean.Classifieds_ProductProfile_ProductID = Convert.ToInt32(productID); eocPropertyBean.Classifieds_ProductProfile_ProductImage = imagePath; intActionResult = bocProductProfile.UpdateRecord_ProductImage(eocPropertyBean); if (intActionResult > 0) { Response.Redirect("ControlPanel.aspx"); } } } } } } }
private void LoadRecord_OrderDetails() { try { using (BOC_Classifieds_ProductProfile bocProductProfile = new BOC_Classifieds_ProductProfile()) { EOC_PropertyBean eocPropertyBean = new EOC_PropertyBean(); eocPropertyBean.Classifieds_ProductProfile_ProductID = intProductID; eocPropertyBean.Classifieds_UserProfile_ProfileID = intProfileID; Repeater1.DataSource = bocProductProfile.LoadRecord_OrderDetails(eocPropertyBean); Repeater1.DataBind(); } } catch (Exception Exp) { Response.Write(Exp.Message.ToString()); } }
/// <summary> /// Loads Classified Posted Product. /// </summary> private void LoadList_Posted_ClassifiedProduct(DateTime _StartDate, DateTime _EndDate) { try { using (BOC_Classifieds_ProductProfile bocProductProfile = new BOC_Classifieds_ProductProfile()) { EOC_PropertyBean eocPropertyBean = new EOC_PropertyBean(); eocPropertyBean.Classifieds_UserProfile_ProfileID = intProfileID; eocPropertyBean.FromDate = _StartDate; eocPropertyBean.ToDate = _EndDate; DataTable dt = bocProductProfile.LoadRecord_ProductProfile(eocPropertyBean); if (dt.Rows.Count > 0) { grvClassifiedProduct.DataSource = dt; grvClassifiedProduct.DataBind(); } else { grvClassifiedProduct.DataSource = null; grvClassifiedProduct.DataBind(); lblClassifiedMessage.Text = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" style=\"width:606px; background-color:#3B5998;\">"; lblClassifiedMessage.Text += "<tr>"; lblClassifiedMessage.Text += "<td align=\"center\" style=\"height:45px; color:#FFFFFF; font-size:14px; font-weight:bold;\" valign=\"middle\">"; lblClassifiedMessage.Text += "<span class=\"title\" style=\"font-size:14px;\">"; lblClassifiedMessage.Text += "</span> You have not posted any Classified Ads yet."; lblClassifiedMessage.Text += "</td>"; lblClassifiedMessage.Text += "</tr>"; lblClassifiedMessage.Text += "</table>"; //lblClassifiedMessage.Text = "You have not posted any Classified Ads yet."; } } } catch (Exception Exp) { //lblCorporateMessage.Text = "Error: " + Exp.Message; } }