本文整理汇总了C#中BrightPlatformEntities.Detach方法的典型用法代码示例。如果您正苦于以下问题:C# BrightPlatformEntities.Detach方法的具体用法?C# BrightPlatformEntities.Detach怎么用?C# BrightPlatformEntities.Detach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrightPlatformEntities
的用法示例。
在下文中一共展示了BrightPlatformEntities.Detach方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadLinkedIn
public void LoadLinkedIn(int accountid, int contactId)
{
ResetValues();
m_contactId = contactId;
this.Cursor = Cursors.WaitCursor;
this.Enabled = false;
try
{
if (accountid > 0 && contactId > 0)
{
using (BrightPlatformEntities _efDbCOntext = new BrightPlatformEntities(UserSession.EntityConnection))
{
string companyname = "";
string contactname = "";
account _eftCompany = _efDbCOntext.accounts.FirstOrDefault(i => i.id == accountid);
if (_eftCompany != null)
{
companyname = _eftCompany.company_name;
_efDbCOntext.Detach(_eftCompany);
//_Url = _eftCompany.www;
}
contact _eftContacts = _efDbCOntext.contacts.FirstOrDefault(i => i.id == contactId);
if (_eftContacts != null)
{
contactname = _eftContacts.first_name + " " + _eftContacts.last_name;
m_linkedin = _eftContacts.linkedin_url;
_efDbCOntext.Detach(_eftContacts);
//_Url = _eftCompany.www;
}
string searchString = contactname + " " + companyname;
if (BrightVision.Common.Utilities.ValidationUtility.IFNullString(m_linkedin,"").Trim() != "")
wbLinkedIn.Url = new Uri(m_linkedin);
else
wbLinkedIn.Url = new Uri("http://www.linkedin.com/search/fpsearch?type=people&keywords=" + searchString + "&pplSearchOrigin=GLHD&pageKey=fps_results");
}
}
else
{
wbLinkedIn.DocumentText =
"<div style=\"padding:40px 40px 40px 40px;\">" +
"<div style=\"background-color:#d9e2b3;border:1px solid #ccc;padding:40px 40px 40px 40px;font-family:arial;" +
"font-size:12px;font-weight:bold;\"><center>No LinkedIn to be search for.</center>" +
"<br/><center><span style=\"font-weight:normal;font-style:italic;margin-top:20px;font-size:9px;\">" +
"Brightvision - We accelerate your sales.</span></center></div></div></div>";
}
}
catch { }
this.Enabled = true;
this.Cursor = Cursors.Default;
}
示例2: btnSave_Click
private void btnSave_Click(object sender, EventArgs e)
{
if (gvNurtureSubCampaign.RowCount < 1)
return;
WaitDialog.Show("Saving data.");
List<string> _lstIds = new List<string>();
for (int i = 0; i < gvNurtureSubCampaign.RowCount; i++) {
CTSubCampaignNurtureItem _item = gvNurtureSubCampaign.GetRow(i) as CTSubCampaignNurtureItem;
if (!Convert.ToBoolean(_item.selected))
continue;
_lstIds.Add(string.Format("<item id=\"{0}\" />", _item.sub_campaign_id));
}
if (_lstIds.Count > 0) {
string _xml = string.Format("<sub_campaign_config><nurture_sub_campaign>{0}</nurture_sub_campaign></sub_campaign_config>", string.Join("", _lstIds.ToArray()));
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
subcampaign _efSubCampaign = _efDbContext.subcampaigns.FirstOrDefault(i => i.id == m_SubCampaignId);
if (_efSubCampaign != null) {
_efSubCampaign.xml_nurture_setting = _xml;
_efDbContext.subcampaigns.ApplyCurrentValues(_efSubCampaign);
_efDbContext.SaveChanges();
_efDbContext.Detach(_efSubCampaign);
}
}
}
WaitDialog.Close();
this.ParentForm.Close();
}
示例3: Save
public static void Save(List<CTScEventAndFollowUpLog> pEventList)
{
using (BrightPlatformEntities _eftDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
event_followup_log _eftEvent = null;
foreach (CTScEventAndFollowUpLog _item in pEventList) {
_eftEvent = _eftDbContext.event_followup_log.FirstOrDefault(i => i.id == _item.id);
if (_eftEvent == null)
continue;
_eftEvent.done = _item.done;
_eftEvent.assigned_user = Convert.ToBoolean(_item.user_taken) ? UserSession.CurrentUser.UserId : 0;
_eftEvent.date_of_transaction = _item.date_of_transaction;
_eftEvent.start_time = Convert.ToDateTime(_item.start_time).TimeOfDay;
_eftEvent.end_time = Convert.ToDateTime(_item.end_time).TimeOfDay;
_eftEvent.title = _item.title;
_eftEvent.event_type = _item.event_type;
_eftEvent.short_message = _item.short_message;
_eftDbContext.event_followup_log.ApplyCurrentValues(_eftEvent);
}
if (pEventList.Count > 0) {
_eftDbContext.SaveChanges();
_eftDbContext.Detach(_eftEvent);
}
}
}
示例4: Delete
public static void Delete(int pEventId)
{
using (BrightPlatformEntities _eftDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
event_followup_log _eftEvent = _eftDbContext.event_followup_log.FirstOrDefault(i => i.id == pEventId);
if (_eftEvent != null) {
_eftDbContext.event_followup_log.DeleteObject(_eftEvent);
_eftDbContext.SaveChanges();
_eftDbContext.Detach(_eftEvent);
}
}
}
示例5: CallLogPlayer
public CallLogPlayer(string pAudioFileUrl, bool pFromStream = false)
{
InitializeComponent();
int _volume = 50;
audio_settings _item = null;
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
_item = _efDbContext.audio_settings.FirstOrDefault(i => i.user_id == UserSession.CurrentUser.UserId);
if (_item != null)
_efDbContext.Detach(_item);
}
if (_item != null && _item.speaker_volume > 0)
_volume = Convert.ToInt32(_item.speaker_volume * 10);
if (pFromStream)
m_MediaType = eMediaType.Stream;
else if (Path.GetExtension(pAudioFileUrl) == ".wav")
m_MediaType = eMediaType.WavFile;
else if (Path.GetExtension(pAudioFileUrl) == ".mp3")
m_MediaType = eMediaType.Mp3File;
m_MediaFile = pAudioFileUrl;
trackBarControl.Properties.Minimum = 0;
if (!pFromStream) {
FileInfo info = new FileInfo(pAudioFileUrl);
if (info.Length == 0) {
NotificationDialog.Information("Player", "Audio file don't have any content.");
m_CanBePlayed = false;
return;
}
}
if (pFromStream) {
//checking for m_MediaFile
}
if (!this.IsMediaValidated()) {
m_CanBePlayed = false;
return;
}
if (m_MediaType == eMediaType.Mp3File)
this.InitializeMp3Audio();
else if (m_MediaType == eMediaType.WavFile)
this.InitializeWavAudio();
else if (m_MediaType == eMediaType.Stream)
if (!this.InitializeStreamAudio())
return;
m_CanBePlayed = true;
if (!this.IsDisposed)
this.btnPlay_Click(null, null);
}
示例6: InitiateLockScreen
private void InitiateLockScreen()
{
user _efoUser = null;
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
m_UserId = UserSession.CurrentUser.UserId;
_efoUser = _efDbContext.users.FirstOrDefault(i => i.id == UserSession.CurrentUser.UserId);
_efDbContext.Detach(_efoUser);
}
tbxUser.Text = _efoUser.fullname;
tbxPassword.Focus();
}
示例7: CanAddDialog
public static bool CanAddDialog(int pSubCampaignId)
{
dialog _eftDialog = null;
using (BrightPlatformEntities _eftDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
_eftDialog = _eftDbContext.dialogs.FirstOrDefault(i => i.subcampaign_id == pSubCampaignId && i.is_active == true);
if (_eftDialog != null) {
_eftDbContext.Detach(_eftDialog);
return true;
}
}
return false;
}
示例8: SaveUpdatedLanguages
public static void SaveUpdatedLanguages(List<LanguageInstance> pList)
{
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
foreach (LanguageInstance Item in pList) {
language _eftLanguage = _efDbContext.languages.Where(element => element.id == Item.id).FirstOrDefault();
_eftLanguage.code = Item.code;
_eftLanguage.name = Item.description;
_efDbContext.SaveChanges();
_efDbContext.Detach(_eftLanguage);
}
}
}
示例9: Exists
public static bool Exists(string pDialogName, int pSubCampaignId)
{
dialog _eftDialog = null;
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
_eftDialog = _efDbContext.dialogs.FirstOrDefault(i => i.name.Equals(pDialogName.Trim()) && i.subcampaign_id == pSubCampaignId && i.is_active == true);
if (_eftDialog != null) {
_efDbContext.Detach(_eftDialog);
return true;
}
}
return false;
}
示例10: GetDocument
public static int GetDocument(int FinalListId, int UserId)
{
sub_campaign_user_sales_scripts _eftUserDocument = null;
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
_eftUserDocument = _efDbContext.sub_campaign_user_sales_scripts.FirstOrDefault(i => i.final_list_id == FinalListId && i.user_id == UserId);
if (_eftUserDocument != null)
_efDbContext.Detach(_eftUserDocument);
}
if (_eftUserDocument == null)
return 0;
return (int)_eftUserDocument.id;
}
示例11: LoadCompanyWebsite
public void LoadCompanyWebsite(string pCompanyWebsite = null)
{
string _Url = string.Empty;
if (string.IsNullOrEmpty(pCompanyWebsite)) {
using (BrightPlatformEntities _efDbCOntext = new BrightPlatformEntities(UserSession.EntityConnection)) {
account _eftCompany = _efDbCOntext.accounts.FirstOrDefault(i => i.id == m_AccountId);
if (_eftCompany != null) {
_efDbCOntext.Detach(_eftCompany);
_Url = _eftCompany.www;
}
}
}
else
_Url = pCompanyWebsite;
theUri = null;
if (_Url != null)
{
try
{
if (!_Url.Contains("http://"))
_Url = "http://" + _Url; //"aa";
if (Uri.IsWellFormedUriString(_Url, UriKind.Absolute))
{
if (Uri.TryCreate(_Url, UriKind.Absolute, out theUri))
{
wbCompanyWebsite.Url = theUri;
}
else
{
theUri = null;
}
}
}
catch
{
}
}
if (theUri == null) {
wbCompanyWebsite.DocumentText =
"<div style=\"padding:40px 40px 40px 40px;\">" +
"<div style=\"background-color:#d9e2b3;border:1px solid #ccc;padding:40px 40px 40px 40px;font-family:arial;" +
"font-size:12px;font-weight:bold;\"><center>No website is currently registered for the selected company.</center>" +
"<br/><center><span style=\"font-weight:normal;font-style:italic;margin-top:20px;font-size:9px;\">" +
"Brightvision - We accelerate your sales.</span></center></div></div></div>";
}
}
示例12: AddSipAccount_Load
private void AddSipAccount_Load(object sender, EventArgs e)
{
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
if (m_SipId != 0) {
sip_accounts _eftSipAccount = _efDbContext.sip_accounts.FirstOrDefault(i => i.id == m_SipId);
_efDbContext.Detach(_eftSipAccount);
textEditSIPUrl.EditValue = _eftSipAccount.sip_url;
textEditDisplayName.EditValue = _eftSipAccount.display_name;
textEditUsername.EditValue = _eftSipAccount.username;
textEditPassword.EditValue = _eftSipAccount.password;
textEditOperator.EditValue = [email protected];
memoEditComment.EditValue = _eftSipAccount.comment;
}
}
}
示例13: FollowUpCallExists
public static bool FollowUpCallExists(event_followup_log pData)
{
using (BrightPlatformEntities _eftDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
event_followup_log _item = _eftDbContext.event_followup_log.FirstOrDefault(
i => i.contact_id == pData.contact_id
&& i.subcampaign_id == pData.subcampaign_id
&& i.account_id == pData.account_id
&& i.done == false
&& pData.event_status.Equals("Follow-Up Call")
);
if (_item != null) {
_eftDbContext.Detach(_item);
return true;
}
return false;
}
}
示例14: AutoLoadReport
public void AutoLoadReport()
{
subcampaign _efoSubCampaign = null;
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
m_efoViewConfig = _efDbContext.view_configuration.FirstOrDefault(i => i.id == m_ViewConfigId);
_efoSubCampaign = _efDbContext.subcampaigns.FirstOrDefault(i => i.id == m_efoViewConfig.subcampaign_id);
_efDbContext.Detach(m_efoViewConfig);
}
lookUpEditCustomerCampaign.EditValue = _efoSubCampaign.campaign_id;
for (int i = 0; i < ccbeSubcampaign.Properties.Items.Count; i++) {
if (ccbeSubcampaign.Properties.Items[i].Description.Equals(_efoSubCampaign.title)) {
ccbeSubcampaign.Properties.Items[i].CheckState = CheckState.Checked;
break;
}
}
cboDisplayMode.SelectedIndex = 0;
this.btnLoad.PerformClick();
m_ViewConfigId = 0;
}
示例15: btnUnlock_Click
private void btnUnlock_Click(object sender, EventArgs e)
{
if (tbxPassword.Text.Length < 1) {
this.InvalidLogin();
return;
}
user _efoUser = null;
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
string _Password = BrightVision.Common.Utilities.HashUtility.GetHashPassword(tbxPassword.Text);
_efoUser = _efDbContext.users.FirstOrDefault(i => i.id == m_UserId && i.password == _Password);
if (_efoUser != null) {
_efDbContext.Detach(_efoUser);
this.Close();
}
else {
tbxPassword.Text = string.Empty;
this.InvalidLogin();
}
}
}