Ejemplo n.º 1
0
    private void SaveOrUpdateValue()
    {
        NHibernate.ITransaction tran = iSabayaContext.PersistencySession.BeginTransaction();
        try
        {
            int id = 0;
            if (!string.IsNullOrEmpty(hddValueID.Value))
            {
                id = int.Parse(hddValueID.Value);
            }
            Incognito inc = null;
            if (id > 0)
            {
                inc = Incognito.Find(iSabayaContext, id);
            }
            else
            {
                inc = new Incognito();
            }

            inc.Reference       = txtReference.Text;
            inc.Remark          = txtRemark.Text;
            inc.OrderedDate     = ctrlOrderedDate.Date;
            inc.Agent           = ctrlAgent.SelectedOrg;
            inc.Alias           = txtAlias.Text;
            inc.Email           = txtEmail.Text;
            inc.Faxes           = txtFaxs.Text;
            inc.MobilePhone     = txtMobile.Text;
            inc.Phone           = txtPhone.Text;
            inc.CitizenOf       = ctrlCitizenOf.Country;
            inc.Nationality     = ctrlNationality.SelectedNode;
            inc.Occupation      = ctrlOccupation.SelectedNode;
            inc.Religion        = ctrlReligion.SelectedNode;
            inc.EffectivePeriod = ctrlEffectivePeriod.Period;
            inc.UpdatedBy       = base.User;
            inc.UpdatedTS       = DateTime.Now;
            inc.Save(iSabayaContext);
            tran.Commit();
            hddValueID.Value = inc.PartyID.ToString();
        }
        catch (Exception ex)
        {
            tran.Rollback();
            if (ex.InnerException != null)
            {
                throw ex.InnerException;
            }
            else
            {
                throw ex;
            }
        }
    }
Ejemplo n.º 2
0
    private void EditFormDataBind()
    {
        //hddValueID.Value = IncognitoID.ToString();
        //ctrlNationality.RootNode = iSabayaContext.imSabayaConfig.NationalityParentNode;
        //ctrlOccupation.RootNode = iSabayaContext.imSabayaConfig.Person.OccupationParentNode;
        //ctrlReligion.RootNode = iSabayaContext.imSabayaConfig.Person.ReligionParentNode;
        int id = IncognitoID;

        if (id > 0)
        {
            IncognitoSource = Incognito.Find(iSabayaContext, id);
            if (IncognitoSource != null)
            {
                lblTitle.Text                = IncognitoSource.ToString();
                hrTitle.Visible              = true;
                txtReference.Text            = IncognitoSource.Reference;
                txtRemark.Text               = IncognitoSource.Remark;
                ctrlOrderedDate.Date         = IncognitoSource.OrderedDate;
                ctrlAgent.SelectedOrg        = IncognitoSource.Agent;
                txtAlias.Text                = IncognitoSource.Alias;
                txtEmail.Text                = IncognitoSource.Email;
                txtFaxs.Text                 = IncognitoSource.Faxes;
                txtMobile.Text               = IncognitoSource.MobilePhone;
                txtPhone.Text                = IncognitoSource.Phone;
                ctrlNationality.SelectedNode = IncognitoSource.Nationality;
                ctrlOccupation.SelectedNode  = IncognitoSource.Occupation;
                ctrlReligion.SelectedNode    = IncognitoSource.Religion;
                ctrlCitizenOf.Country        = IncognitoSource.CitizenOf;
                ctrlEffectivePeriod.Period   = IncognitoSource.EffectivePeriod;
                return;
            }
        }
        lblTitle.Text              = string.Empty;
        hrTitle.Visible            = false;
        IncognitoSource            = null;
        txtReference.Text          = string.Empty;
        txtRemark.Text             = string.Empty;
        ctrlOrderedDate.Date       = DateTime.Today;
        ctrlAgent.SelectedOrg      = null;
        txtAlias.Text              = string.Empty;
        txtEmail.Text              = string.Empty;
        txtFaxs.Text               = string.Empty;
        txtMobile.Text             = string.Empty;
        txtPhone.Text              = string.Empty;
        ctrlCitizenOf.Country      = null;
        ctrlEffectivePeriod.Period = new TimeInterval(DateTime.Today);
    }