Exemple #1
0
    /// <summary>
    /// Load data use for Page_Load and rase load data for already owner
    /// </summary>
    public void LoadData()
    {
        if (IsAlreadyOwner)
        {
            if (OwnerID != 0 && OwnerDiscriminator != 0)
            {
                sdsPartyAttribute.SelectParameters["partyID"].DefaultValue       = OwnerID.ToString();
                sdsPartyAttribute.SelectParameters["discriminator"].DefaultValue = OwnerDiscriminator.ToString();
                gdvPartyAttribute.DataSourceID = "sdsPartyAttribute";
                gdvPartyAttribute.DataSource   = null;

                ((GridViewDataTextColumn)gdvPartyAttribute.Columns["EffectiveFrom"]).FieldName = "EffectiveFrom";
                GridViewDataTextColumn c = (GridViewDataTextColumn)gdvPartyAttribute.Columns["EffectiveTo"];
                c.FieldName = "EffectiveTo";
                c.Visible   = true;
                c.Caption   = ResGeneral.EffectiveFrom;
                gdvPartyAttribute.HtmlRowPrepared += gdvPartyAttribute_HtmlRowPrepared;
                btnAdd.ClientEnabled = true;
            }
            else
            {
                btnAdd.ClientEnabled = false;
            }
        }
        else
        {
            // Initial for only is null;
            gdvPartyAttribute.DataSourceID = "";
            gdvPartyAttribute.DataSource   = PartyAttributes;
            if (!Page.IsCallback)
            {
                GridViewDataTextColumn c = (GridViewDataTextColumn)gdvPartyAttribute.Columns["EffectiveFrom"];
                c.FieldName        = "EffectivePeriod";
                c.Caption          = ResGeneral.EffectivePeriod;
                c                  = (GridViewDataTextColumn)gdvPartyAttribute.Columns["EffectiveTo"];
                c.FieldName        = "";
                c.Visible          = false;
                btnExpire.Text     = ResGeneral.Delete;
                btnExpire.ImageUrl = ResImageURL.Delete;
            }
        }
    }
 public OwnerContract[] FindOwner(OwnerDiscriminator d, LocationDiscriminator l)
 {
     try
     {
         using (var records = RepositoryFactory.GetOwner())
         {
             records.Discriminator  = d;
             records.LocationFilter = l;
             return(records.Select(r => new OwnerContract()
             {
                 Owner = r
             }).ToArray());
         }
     }
     catch (Exception ex)
     {
         HandleMyException(ex);
         return(null);
     }
 }