protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            branchesOperator = new BranchDAL();

            if (!IsPostBack)
            {
                LoadPagedData();
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, CommonStrings.ViewDefault)));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            branchesOperator = new BranchDAL();

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

                    if (info != null)
                    {
                        txtID.Text = info.ID.ToString();
                        txtSupplierID.Text = info.SupplierID.ToString();
                        txtNameAr.Text = info.NameAr;
                        txtNameEn.Text = info.NameEn;
                        txtAddressAr.Value = info.AddressAr;
                        txtAddressEn.Value = info.AddressEn;
                        txtDistrictAr.Text = info.BranchLocation.DistrictAr;
                        txtDistrictEn.Text = info.BranchLocation.DistrictEn;
                        txtPhone.Text = info.Phone1;
                        txtFax.Text = info.Fax;
                        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
        {
            List<KeyValue> paramsList = new List<KeyValue>();
            paramsList.Add(new KeyValue("SuppID", Request.QueryString["SuppID"]));
            paramsList.Add(new KeyValue(CommonStrings.BackUrl, "ListSuppliers"));

            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, paramsList));
        }
    }
    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")));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            branchesOperator = new BranchDAL();

            if (!IsPostBack)
            {
                BindGrid();
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "ListSuppliers")));
        }
    }