Example #1
0
    public void InitializeControl()
    {
        try
        {
            fairsOperator = new FairDAL();

            if (!IsPostBack)
            {
                List<Fair> fairsList = fairsOperator.SelectAll((bool?)IsArabic, true);

                if (fairsList != null && fairsList.Count > 0)
                {
                    rptFairs.DataSource = fairsList;
                    rptFairs.DataBind();
                }
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, CommonStrings.ViewDefault)));
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            fairsOperator = new FairDAL();

            if (!IsPostBack)
            {
                LocationDAL locationOperator = new LocationDAL();
                List<Location> locationList = locationOperator.SelectAll((bool?)IsArabic);

                if (locationList != null && locationList.Count > 0)
                {
                    drpLocation.DataSource = locationList;
                    drpLocation.DataValueField = Location.CommonColumns.ID;
                    if (IsArabic)
                        drpLocation.DataTextField = Location.TableColumns.DistrictAr;
                    else
                        drpLocation.DataTextField = Location.TableColumns.DistrictEn;

                    drpLocation.DataBind();
                }
                drpLocation.Items.Insert(0, Literals.ListHeader);

                if (Request.QueryString[CommonStrings.ID] != null)
                {
                    Fair info
                        = fairsOperator.SelectByID(Convert.ToInt32(Request.QueryString[CommonStrings.ID]), null);

                    if (info != null)
                    {
                        imgPicture.ImageUrl = GetSmallImage(info.Image);
                        ViewState.Add("FairImage", info.Image);

                        txtNameAr.Text = info.NameAr;
                        txtNameEn.Text = info.NameEn;
                        txtAddressAr.Value = info.AddressAr;
                        txtAddressEn.Value = info.AddressEn;
                        txtShortDescriptionAr.Value = info.ShortDescriptionAr;
                        txtShortDescriptionEn.Value = info.ShortDescriptionEn;
                        txtDescriptionAr.Value = info.DescriptionAr;
                        txtDescriptionEn.Value = info.DescriptionEn;
                        txtContactPerson.Text = info.ContactPerson;
                        txtContactPersonEmail.Text = info.ContactPersonEmail;
                        txtContactPersonMobile.Text = info.ContactPersonMobile;
                        txtWebsite.Text = info.Website;
                        txtEmail.Text = info.Email;
                        txtPhone1.Text = info.Phone1;
                        txtPhone2.Text = info.Phone2;
                        txtPhone3.Text = info.Phone3;
                        txtMobile1.Text = info.Mobile1;
                        txtMobile2.Text = info.Mobile2;
                        txtMobile3.Text = info.Mobile3;
                        txtFax.Text = info.Fax;
                        txtStartDate.Text = string.Concat(Convert.ToString(info.StartDate.Day), '/', Convert.ToString(info.StartDate.Month), '/', Convert.ToString(info.StartDate.Year));
                        txtEndDate.Text = string.Concat(Convert.ToString(info.EndDate.Day), '/', Convert.ToString(info.EndDate.Month), '/', Convert.ToString(info.EndDate.Year));

                        if (info.IsActive)
                            chkIsActive.Checked = true;

                        if (drpLocation.Items.FindByValue(info.LocationInfo.ID.ToString()) != null)
                            drpLocation.Items.FindByValue(info.LocationInfo.ID.ToString()).Selected = true;

                        divPicture.Style[CommonStrings.HTMLDisplay] = CommonStrings.HTMLBlock;
                        divPathHeader.Style[CommonStrings.HTMLDisplay] = CommonStrings.HTMLNone;
                        divUploader.Style[CommonStrings.HTMLDisplay] = CommonStrings.HTMLNone;
                    }

                    hidImageFlag.Value = CommonStrings.OldImage;
                }
                else
                {
                    divPicture.Style[CommonStrings.HTMLDisplay] = CommonStrings.HTMLNone;
                    divPathHeader.Style[CommonStrings.HTMLDisplay] = CommonStrings.HTMLBlock;
                    divUploader.Style[CommonStrings.HTMLDisplay] = CommonStrings.HTMLBlock;
                }
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "ListFairs")));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            fairOperator = new FairDAL();

            if (!IsPostBack)
            {
                if (Request.QueryString[CommonStrings.ID] != null)
                {
                    Fair info
                        = fairOperator.SelectByID(Convert.ToInt32(Request.QueryString[CommonStrings.ID]), (bool?)IsArabic);

                    if (info != null)
                    {
                        lblStartDate.Text = info.StartDate.ToShortDateString();
                        lblEndDate.Text = info.EndDate.ToShortDateString();
                        imgFair.ImageUrl = GetSmallImage(info.Image);

                        if (info.Likes.HasValue)
                            lblLikes.Text = info.Likes.ToString();

                        if (info.Rate.HasValue)
                            lblRate.Text = info.Rate.ToString();

                        if (info.RateCount.HasValue)
                            lblRateCount.Text = info.RateCount.ToString();

                        if (!string.IsNullOrEmpty(info.Phone1))
                        {
                            phone1Div.Visible = true;
                            lblPhone1.Text = info.Phone1;
                        }
                        else
                        {
                            phone1Div.Visible = false;
                        }

                        if (!string.IsNullOrEmpty(info.Phone2))
                        {
                            phone2Div.Visible = true;
                            lblPhone2.Text = info.Phone2;
                        }
                        else
                        {
                            phone2Div.Visible = false;
                        }

                        if (!string.IsNullOrEmpty(info.Phone3))
                        {
                            phone3Div.Visible = true;
                            lblPhone3.Text = info.Phone3;
                        }
                        else
                        {
                            phone3Div.Visible = false;
                        }

                        if (!string.IsNullOrEmpty(info.Mobile1))
                        {
                            mobile1Div.Visible = true;
                            lblMobile1.Text = info.Mobile1;
                        }
                        else
                        {
                            mobile1Div.Visible = false;
                        }

                        if (!string.IsNullOrEmpty(info.Mobile2))
                        {
                            mobile2Div.Visible = true;
                            lblMobile2.Text = info.Mobile2;
                        }
                        else
                        {
                            mobile2Div.Visible = false;
                        }

                        if (!string.IsNullOrEmpty(info.Mobile3))
                        {
                            mobile3Div.Visible = true;
                            lblMobile3.Text = info.Mobile3;
                        }
                        else
                        {
                            mobile3Div.Visible = false;
                        }

                        if (!string.IsNullOrEmpty(info.Fax))
                        {
                            faxDiv.Visible = true;
                            lblFax.Text = info.Fax;
                        }
                        else
                        {
                            faxDiv.Visible = false;
                        }

                        if (!string.IsNullOrEmpty(info.Website))
                        {
                            websiteDiv.Visible = true;
                            lblWebsite.Text = info.Website;
                            lblWebsite.NavigateUrl = info.Website;
                        }
                        else
                        {
                            websiteDiv.Visible = false;
                        }

                        if (!string.IsNullOrEmpty(info.Email))
                        {
                            emailDiv.Visible = true;
                            lblEmail.Text = info.Email;
                            lblEmail.NavigateUrl = info.Email;
                        }
                        else
                        {
                            emailDiv.Visible = false;
                        }

                        if (IsArabic)
                        {
                            lblName.Text = info.NameAr;
                            lblAddress.Text = info.AddressAr;
                            lblLocation.Text = info.LocationInfo.DistrictAr;
                            if (!string.IsNullOrEmpty(info.DescriptionAr))
                            {
                                descriptionDiv.Visible = true;
                                lblDescription.Text = info.DescriptionAr;

                                shortDescriptionDiv.Visible = false;
                            }
                            else
                            {
                                descriptionDiv.Visible = false;

                                shortDescriptionDiv.Visible = true;
                                lblShortDescription.Text = info.ShortDescriptionAr;
                            }
                        }
                        else
                        {
                            lblName.Text = info.NameEn;
                            lblAddress.Text = info.AddressEn;
                            lblLocation.Text = info.LocationInfo.DistrictEn;
                            if (!string.IsNullOrEmpty(info.DescriptionEn))
                            {
                                descriptionDiv.Visible = true;
                                lblDescription.Text = info.DescriptionEn;

                                shortDescriptionDiv.Visible = false;
                            }
                            else
                            {
                                descriptionDiv.Visible = false;

                                shortDescriptionDiv.Visible = true;
                                lblShortDescription.Text = info.ShortDescriptionEn;
                            }
                        }
                    }
                }
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "ListFairs")));
        }
    }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            fairsOperator = new FairDAL();

            if (!IsPostBack)
            {
                BindGrid();
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, CommonStrings.AdminDefault)));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            fairsOperator = new FairDAL();

            if (!IsPostBack)
            {
                if (Request.QueryString[CommonStrings.ID] != null)
                {
                    Fair info
                        = fairsOperator.SelectByID(Convert.ToInt32(Request.QueryString[CommonStrings.ID]), null);

                    if (info != null)
                    {
                        txtID.Text = info.ID.ToString();
                        txtNameAr.Text = info.NameAr;
                        txtNameEn.Text = info.NameEn;
                        txtAddressAr.Value = info.AddressAr;
                        txtAddressEn.Value = info.AddressEn;
                        txtShortDescriptionAr.Value = info.ShortDescriptionAr;
                        txtShortDescriptionEn.Value = info.ShortDescriptionEn;
                        txtDescriptionAr.Value = info.DescriptionAr;
                        txtDescriptionEn.Value = info.DescriptionEn;
                        txtContactPerson.Text = info.ContactPerson;
                        txtContactPersonEmail.Text = info.ContactPersonEmail;
                        txtContactPersonMobile.Text = info.ContactPersonMobile;
                        txtWebsite.Text = info.Website;
                        txtEmail.Text = info.Email;
                        txtPhone1.Text = info.Phone1;
                        txtPhone2.Text = info.Phone2;
                        txtPhone3.Text = info.Phone3;
                        txtMobile1.Text = info.Mobile1;
                        txtMobile2.Text = info.Mobile2;
                        txtMobile3.Text = info.Mobile3;
                        txtFax.Text = info.Fax;
                        txtStartDate.Text = info.StartDate.ToShortDateString();
                        txtEndDate.Text = info.EndDate.ToShortDateString();
                        imgPicture.ImageUrl = GetSmallImage(info.Image);
                        txtLocationAr.Text = info.LocationInfo.DistrictAr;
                        txtLocationEn.Text = info.LocationInfo.DistrictEn;
                        txtCreationDate.Text = info.CreationDate.ToShortDateString();

                        if (info.Rate.HasValue)
                            txtRate.Text = info.Rate.Value.ToString();

                        if (info.RateCount.HasValue)
                            txtRateCount.Text = info.RateCount.Value.ToString();

                        if (info.RateTotal.HasValue)
                            txtRateTotal.Text = info.RateTotal.Value.ToString();

                        if (info.Likes.HasValue)
                            txtLikes.Text = info.Likes.Value.ToString();

                        if (info.CreatedBy.HasValue)
                            txtCreatedBy.Text = info.CreatedBy.Value.ToString();

                        if (info.ModificationDate.HasValue)
                            txtModificationDate.Text = info.ModificationDate.Value.ToShortDateString();

                        if (info.ModifiedBy.HasValue)
                            txtModifiedBy.Text = info.ModifiedBy.Value.ToString();

                        if (info.ActivationDate.HasValue)
                            txtActivationDate.Text = info.ActivationDate.Value.ToShortDateString();

                        if (info.ActivatedBy.HasValue)
                            txtActivatedBy.Text = info.ActivatedBy.Value.ToString();

                        if (info.DeactivationDate.HasValue)
                            txtDeactivationDate.Text = info.DeactivationDate.Value.ToShortDateString();

                        if (info.DeactivatedBy.HasValue)
                            txtDeactivatedBy.Text = info.DeactivatedBy.Value.ToString();

                        if (info.IsActive)
                            txtStatus.Text = Literals.Active;
                        else
                            txtStatus.Text = Literals.NotActive;
                    }
                }
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "ListFairs")));
        }
    }