protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            brandOperator = new BrandDAL();

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

                    if (info != null)
                    {
                        imgBrand.ImageUrl = GetSmallImage(info.Image);

                        offersAnch.HRef = Utility.AppendQueryString(PagesPathes.OffersList, new KeyValue("BrandID", Request.QueryString[CommonStrings.ID]));

                        if (IsArabic)
                        {
                            imgBrand.AlternateText = info.NameAr;
                            imgBrand.ToolTip = info.NameAr;

                            ltrlName.Text = info.NameAr;
                            if (string.IsNullOrEmpty(info.DescriptionAr))
                                ltrlDescription.Text = info.ShortDescriptionAr;
                            else
                                ltrlDescription.Text = info.DescriptionAr;
                        }
                        else
                        {
                            imgBrand.AlternateText = info.NameEn;
                            imgBrand.ToolTip = info.NameEn;

                            ltrlName.Text = info.NameEn;
                            if (string.IsNullOrEmpty(info.DescriptionEn))
                                ltrlDescription.Text = info.ShortDescriptionEn;
                            else
                                ltrlDescription.Text = info.DescriptionEn;
                        }

                        emptyDataDiv.Visible = false;
                    }
                    else
                    {
                        emptyDataDiv.Visible = true;
                    }
                }
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "BrandsList")));
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            brandsOperator = new BrandDAL();

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

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

                        txtNameAr.Text = info.NameAr;
                        txtNameEn.Text = info.NameEn;
                        txtDescriptionAr.Value = info.DescriptionAr;
                        txtDescriptionEn.Value = info.DescriptionEn;

                        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, "ListBrands")));
        }
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            brandsOperator = new BrandDAL();

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

                    if (info != null)
                    {
                        txtID.Text = info.ID.ToString();
                        txtNameAr.Text = info.NameAr;
                        txtNameEn.Text = info.NameEn;
                        txtDescriptionAr.Value = info.DescriptionAr;
                        txtDescriptionEn.Value = info.DescriptionEn;
                        imgPicture.ImageUrl = GetSmallImage(info.Image);
                        txtCreationDate.Text = info.CreationDate.ToShortDateString();

                        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();
                    }
                }
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "ListBrands")));
        }
    }