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 ddlAccountContact_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.Accounts; childform.ShowDialog(); if (childform.ORGContact != null) { ServerModeSourceContactAccount.QueryableSource = DataContext.ReadonlyContext.VW_Contact.Where(n => (n.CompanyId == null || n.CompanyId == childform.ORGContact.CompanyId) && n.DepartmentId == (byte)BL.ORG.ORG_Department.Accounts); ServerModeSourceContactAccount.Reload(); if (ddlAccountContact.EditValue != DBNull.Value && Convert.ToInt64(ddlAccountContact.EditValue) > 0) { OldAccountsContact = Convert.ToInt64(ddlAccountContact.EditValue); } orgAccountsContact = childform.ORGContact; ddlAccountContact.EditValue = childform.ORGContact.Id; } } }