public override void RefreshRecord() { base.RefreshRecord(); if (IsNew) { ServerModeSourceContactSales.QueryableSource = DataContext.ReadonlyContext.VW_Contact.Where(n => (n.CompanyId == null || n.CompanyId == orgEntitysysEntity.Id) && n.DepartmentId == (byte)BL.ORG.ORG_Department.Sales); ServerModeSourceContactSales.Reload(); ServerModeSourceContactAccount.QueryableSource = DataContext.ReadonlyContext.VW_Contact.Where(n => (n.CompanyId == null || n.CompanyId == orgEntitysysEntity.Id) && n.DepartmentId == (byte)BL.ORG.ORG_Department.Accounts); ServerModeSourceContactAccount.Reload(); } else { DataContext.EntityOrganisationContext.ReloadEntry(BindingSource.DataSource); DataContext.EntityOrganisationContext.ReloadEntry(BindingSourceORGEntity.DataSource); DataContext.EntityOrganisationContext.ReloadEntry(orgSalesContact); DataContext.EntityOrganisationContext.ReloadEntry(orgAccountsContact); DataContext.EntitySystemContext.ReloadEntry(BindingSourceORGEntitySYSEntity.DataSource); DataContext.EntitySystemContext.ReloadEntry(BindingSourceShippingAddress.DataSource); DataContext.EntitySystemContext.ReloadEntry(BindingSourceBillingAddress.DataSource); DataContext.EntityOrganisationContext.ReloadEntry(BindingSourceORGDistribution.DataSource); InstantFeedbackSourceTransaction.Refresh(); InstantFeedbackSourceHistory.Refresh(); ServerModeSourceContactSales.QueryableSource = DataContext.ReadonlyContext.VW_Contact.Where(n => (n.CompanyId == null || n.CompanyId == orgEntitysysEntity.Id) && n.DepartmentId == (byte)BL.ORG.ORG_Department.Sales); ServerModeSourceContactSales.Reload(); ServerModeSourceContactAccount.QueryableSource = DataContext.ReadonlyContext.VW_Contact.Where(n => (n.CompanyId == null || n.CompanyId == orgEntitysysEntity.Id) && n.DepartmentId == (byte)BL.ORG.ORG_Department.Accounts); ServerModeSourceContactAccount.Reload(); } }
//private void clbStatementPreference_ItemChecking(object sender, DevExpress.XtraEditors.Controls.ItemCheckingEventArgs e) //{ // if ((clbStatementPreferenceo.GetItem(e.Index) as DB.ORG_StatementPreference).Id == (byte)BL.ORG.ORG_StatementPreference.Ignore && e.NewValue == CheckState.Checked) // { // clbStatementPreferenceo.UnCheckAll(); // } // else if ((clbStatementPreferenceo.GetItem(e.Index) as DB.ORG_StatementPreference).Id != (byte)BL.ORG.ORG_StatementPreference.Ignore && e.NewValue == CheckState.Checked) // { // for (int i = 0; i < clbStatementPreferenceo.ItemCount; i++) // { // DB.ORG_StatementPreference pref = (clbStatementPreferenceo.GetItem(i) as DB.ORG_StatementPreference); // if (pref.Id == (byte)BL.ORG.ORG_StatementPreference.Ignore && clbStatementPreferenceo.GetItemChecked(i)) // clbStatementPreferenceo.SetItemChecked(i, false); // } // } //} private void ddlSalesContact_Properties_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (e.Button.Tag != null && Convert.ToString(e.Button.Tag).Equals("New")) { Contact.ContactDialogue childform = new Contact.ContactDialogue(); childform.Department = BL.ORG.ORG_Department.Sales; childform.ShowDialog(); if (childform.ORGContact != null) { ServerModeSourceContactSales.QueryableSource = DataContext.ReadonlyContext.VW_Contact.Where(n => (n.CompanyId == null || n.CompanyId == childform.ORGContact.CompanyId) && n.DepartmentId == (byte)BL.ORG.ORG_Department.Sales); ServerModeSourceContactSales.Reload(); if (ddlSalesContact.EditValue != DBNull.Value && Convert.ToInt64(ddlSalesContact.EditValue) > 0) { OldSalesContact = Convert.ToInt64(ddlSalesContact.EditValue); } orgSalesContact = childform.ORGContact; ddlSalesContact.EditValue = childform.ORGContact.Id; } } }