StrataFrame Forum

SharedDataTable is missing

http://forum.strataframe.net/Topic27273.aspx

By ChanKK - 5/31/2010

Hi,

I have problem as below. It seem like the sharedDataTable is just gone or its key just changed. May I know in what condition it could happen? I am using 1.6.9.9. I can't upgrade now.





The given key was not present in the dictionary.



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



Exception Details: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.



Source Error:





Line 239: {

Line 240: this.GetBackupPendingLeaves();

Line 241: this.LVELeaves.Refresh();

Line 242: this.grdvPendingLeaves.DataBind();

Line 243:



Source File: D:\FlexHR\Trunk\Mainline\Leave\UI\Web\Forms\FormBackupPendingLeaves.aspx.cs Line: 241



Stack Trace:





[KeyNotFoundException: The given key was not present in the dictionary.]

System.ThrowHelper.ThrowKeyNotFoundException() +28

System.Collections.Generic.Dictionary`2.get_Item(TKey key) +7456284

MicroFour.StrataFrame.Business.SharedDataTableCollection.get_Item(String SharedTableKey) +47

MicroFour.StrataFrame.Business.BusinessLayer.get__CurrentDataTable(Boolean IsSharedTable) +202

MicroFour.StrataFrame.Business.BusinessLayer.get__CurrentDataTable() +41

MicroFour.StrataFrame.Business.BusinessLayer.RefreshBoundControls() +76

MicroFour.StrataFrame.Business.BusinessLayer.Refresh() +31

Vfs.Leave.UI.Web.Forms.FormBackupPendingLeaves.submitDocument(String action) in D:\FlexHR\Trunk\Mainline\Leave\UI\Web\Forms\FormBackupPendingLeaves.aspx.cs:241

Vfs.Leave.UI.Web.Forms.FormBackupPendingLeaves.btnApprove_Click(Object sender, EventArgs e) in D:\FlexHR\Trunk\Mainline\Leave\UI\Web\Forms\FormBackupPendingLeaves.aspx.cs:153

DevExpress.Web.ASPxEditors.ASPxButton.OnClick(EventArgs e) +101

DevExpress.Web.ASPxEditors.ASPxButton.RaisePostBackEvent(String eventArgument) +406

DevExpress.Web.ASPxClasses.ASPxWebControl.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13

System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
By ChanKK - 5/31/2010

Hi,

I found that, if I remved code to call BO.CopyDataFrom() from GetBackupPendingLeaves() then would work fine. Beside, I have another screen which similar to this, but using FillBy...() and working fine as well.



Any ideas?



Thank you
By Ivan George Borges - 6/1/2010

Hi Chan.

Could you post the code where you think the problem is?

By ChanKK - 6/1/2010

Hi,

MasterPage



public void MasterPage.Page_Load()

{

if (!this.IsPostBack)

{

this.InitializeBackupLeavesListing(this._employees.EmployeeNo);

}

}



private void InitializeBackupLeavesListing(string backupEmployeeNo)

{

LVELeavesBO leavesBO;

LVELeavesBO leavesBackupBO;



bool isLoaded = SessionManager.Instance.Get(SessionVariableConstants.IS_PENDING_FOR_BACKUP_LEAVES_LOADED);



if (isLoaded)

{

leavesBackupBO = SessionManager.Instance.Get(SessionVariableConstants.PENDING_FOR_BACKUP_LEAVES_BO);

}

else

{

leavesBO = new LVELeavesBO();

leavesBackupBO = new LVELeavesBO();



object value = SessionManager.Instance.Get(SessionVariableConstants.CURRENT_SYSDOCID);

Guid SysDocId = Guid.Empty;



if (value != null)

{

SysDocId = new Guid(value.ToString());

}



BackupsBO BackupsPendingList = new BackupsBO();



BackupsPendingList.FillByBackupEmployeeNoBySysDocByPeriod(backupEmployeeNo, SysDocId, DateTime.Today);





if (BackupsPendingList.Count > 0)

{

if (BackupsPendingList.MoveFirst())

{

do

{

leavesBO.FillPendingLeavesByApprover(BackupsPendingList.ApproverEmployeeNo);

leavesBackupBO.CopyDataFrom(leavesBO, MicroFour.StrataFrame.Business.BusinessCloneDataType.AppendDataToTableFromCompleteTable);

}

while (BackupsPendingList.MoveNext());

}



SessionManager.Instance.Set(SessionVariableConstants.PENDING_FOR_BACKUP_LEAVES_BO, leavesBackupBO);

SessionManager.Instance.Set(SessionVariableConstants.IS_PENDING_FOR_BACKUP_LEAVES_LOADED, true);

}

}

}



private void UpdateBackupPendingTaskCount()

{

int count = 0;

LVELeavesBO leavesBackupBO;



if (!SessionManager.Instance.Get(SessionVariableConstants.IS_PENDING_FOR_BACKUP_LEAVES_LOADED))

{

this.InitializeBackupLeavesListing(this._employees.EmployeeNo);

}



leavesBackupBO = SessionManager.Instance.Get(SessionVariableConstants.PENDING_FOR_BACKUP_LEAVES_BO);



if (leavesBackupBO != null && leavesBackupBO.Count > 0)

{

string filterExpr = leavesBackupBO.Filter;



leavesBackupBO.Filter = "DocStatus IN (" + DocStatusType.Pending.GetHashCode() + "," + DocStatusType.PendingForBeforeApprove.GetHashCode() + "," + DocStatusType.PendingForAfterApproved.GetHashCode() + ")";



count = leavesBackupBO.Count;



leavesBackupBO.Filter = filterExpr;

}



// Update Total Pending Leaves by Approver Employee No

if (this._navigations.Seek("IsBackup"))

{

NavBarItem barItem = this.BaseNavigationBar1.Items.FindByName(this._navigations.NavigationId.ToString());



if (barItem != null)

{

barItem.Text = barItem.Text + string.Format("({0})", count);

}

}

}



private void Page_PreRender(object sender, EventArgs e)

{

//----------------------------------------------------------------------------------

//-- Initialize pending / backup pending leave count only at this stage so that it

//-- always show the updated pending count

//----------------------------------------------------------------------------------

this.UpdateBackupPendingTaskCount();

}







WebPage



protected void Page_Load(object sender, EventArgs e)

{

this.Initialize();

}



private void Initialize()

{

if (Convert.ToBoolean(SessionManager.Instance.Get(SessionVariableConstants.IS_PENDING_FOR_BACKUP_LEAVES_LOADED)))

{

this.LVELeaves.CopyDataFrom((LVELeavesBO)SessionManager.Instance.Get(SessionVariableConstants.PENDING_FOR_BACKUP_LEAVES_BO), MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable);

}

else

{

this.GetBackupPendingLeaves();

}

}



private void GetBackupPendingLeaves()

{

EmployeesBO backupEmployees;

LVELeavesBO backupLeaves = new LVELeavesBO();



backupEmployees = SessionManager.Instance.Get(EmployeesBO.WebSessionVariable) as EmployeesBO;



this.BackupsPendingList.FillByBackupEmployeeNoBySysDocByPeriod(backupEmployees.EmployeeNo, SysDocId, DateTime.Today);



if (this.BackupsPendingList.Count > 0)

{

this.LVELeaves.Clear();

if (this.BackupsPendingList.MoveFirst())

{

do

{

backupLeaves.FillPendingLeavesByApprover(this.BackupsPendingList.ApproverEmployeeNo);

this.LVELeaves.CopyDataFrom(backupLeaves, MicroFour.StrataFrame.Business.BusinessCloneDataType.AppendDataToTableFromCompleteTable);

}

while (this.BackupsPendingList.MoveNext());

}



SessionManager.Instance.Set(SessionVariableConstants.PENDING_FOR_BACKUP_LEAVES_BO, this.LVELeaves);

SessionManager.Instance.Set(SessionVariableConstants.IS_PENDING_FOR_BACKUP_LEAVES_LOADED, true);

}

}



protected void Page_Unload(object sender, EventArgs e)

{

SessionManager.Instance.Remove(SessionVariableConstants.IS_PENDING_FOR_BACKUP_LEAVES_LOADED);

SessionManager.Instance.Remove(SessionVariableConstants.PENDING_FOR_BACKUP_LEAVES_BO);

}






By Ivan George Borges - 6/2/2010

Hi Chan.

I am probably missing the point and I am sorry for this, but I couldn't see where you are sharing the tables, couldn't find where you set the SharedDataTableKey. Someone will probably chime in here and help us with that.

By ChanKK - 6/2/2010

Hi

Sorry for unclear info.

I am using Web Business Binding Source for ASP.NET development. ShareDataTable is turned on automatically



Thank you
By ChanKK - 6/7/2010

any good news??
By Ivan George Borges - 6/7/2010

Hey Chan.

I know for a fact that there has been some changes in this area lately. What I would suggest you right now would be to load on a virtual or test machine, download the most recent update build and see if it gets resolved.