public static void ReloadSalesOrderStep(IAddEditSalesOrder form, EventArgs args)
 {
     using (NHibernate.ISession session = new SessionScopeWrapper(false))
     {
         // forces NHibernate to reload the object
         session.Refresh(form.CurrentEntity);
     }
 }
    private void UpdateDataEvent(object sender, EventArgs e)
    {
        var groupId = string.Empty;
        var message = string.Empty;

        using (var session = new SessionScopeWrapper())
        {
            groupId = session.CreateSQLQuery("select FB_COMGACC.FB_COMPANIESGROUPID from FB_COMGACC where FB_COMGACC.ENTITYID = :accountId")
                      .SetString("accountId", Convert.ToString(ParentAccount.Id))
                      .List <string>()
                      .FirstOrDefault();
        }

        if (groupId == null)
        {
            message += (string.IsNullOrEmpty(message) ? string.Empty : "<br/>") + " - " + Convert.ToString(GetLocalResourceObject("lblCompanyGroupName.Text")).Replace(":", string.Empty);
        }

        if (!string.IsNullOrEmpty(message))
        {
            ScriptManager.RegisterStartupScript(this, GetType(), ClientID + "_RequiredFiledsValidation", "setTimeout(function() { Sage.UI.Dialogs.alert('" + GetLocalResourceObject("RequiredFiledsValidation.Message") + "<br/>" + message + "'); }, 1);", true);
            return;
        }

        CurrentEntity.Category         = "3" + pklCategory.PickListValue;
        CurrentEntity.RegistrationDate = dtpRegistrationDate.DateTimeValue.HasValue ? (DateTime?)dtpRegistrationDate.DateTimeValue.Value.ToLocalTime() : null;
        CurrentEntity.Save();

        using (var session = new SessionScopeWrapper())
        {
            session.Refresh(CurrentEntity);
        }

        PanelRefresh.RefreshAll();
        DialogService.CloseEventHappened(sender, e);
    }