protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            locationsOperator = new LocationDAL();

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

                    if (info != null)
                    {
                        txtNameAr.Text = info.DistrictAr;
                        txtNameEn.Text = info.DistrictEn;
                    }
                }
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "ListLocations")));
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         locationOperator = new LocationDAL();
         if (!IsPostBack)
         {
             BindGrid();
         }
     }
     catch
     {
         Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, CommonStrings.AdminDefault)));
     }
 }
Exemple #3
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
        {
            branchesOperator = new BranchDAL();

            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)
                {
                    Branch info
                        = branchesOperator.SelectByID(Convert.ToInt32(Request.QueryString[CommonStrings.ID]), null);

                    if (info != null)
                    {
                        txtNameAr.Text = info.NameAr;
                        txtNameEn.Text = info.NameEn;
                        txtAddressAr.Value = info.AddressAr;
                        txtAddressEn.Value = info.AddressEn;
                        txtPhone.Text = info.Phone1;
                        txtFax.Text = info.Fax;
                        if (drpLocation.Items.FindByValue(info.BranchLocation.ID.ToString()) != null)
                            drpLocation.Items.FindByValue(info.BranchLocation.ID.ToString()).Selected = true;
                    }
                }
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "ListSuppliers")));
        }
    }