当前位置: 首页>>代码示例>>C#>>正文


C# BrightPlatformEntities类代码示例

本文整理汇总了C#中BrightPlatformEntities的典型用法代码示例。如果您正苦于以下问题:C# BrightPlatformEntities类的具体用法?C# BrightPlatformEntities怎么用?C# BrightPlatformEntities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BrightPlatformEntities类属于命名空间,在下文中一共展示了BrightPlatformEntities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
                }
            }
        }
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2: AddCompaniesToSubCampaign

        /// <summary>
        /// Add new companies to an existing sub-campaign
        /// </summary>
        /// <param name="lstAcctIds"></param>
        /// <param name="SubCampaignId"></param>
        public static void AddCompaniesToSubCampaign(List<int> lstAcctIds, int SubCampaignId, string ListSource = "")
        {
            BrightPlatformEntities _efDbModel = new BrightPlatformEntities(UserSession.EntityConnection);
            int? _FinalListId = _efDbModel.final_lists.FirstOrDefault(i => i.sub_campaign_id == SubCampaignId).id;
            if (_FinalListId > 0)
            {
                foreach (int _AcctId in lstAcctIds)
                {
                    sub_campaign_account_lists _item = new sub_campaign_account_lists()
                    {
                        final_list_id = (int)_FinalListId,
                        account_id = _AcctId,
                        created_by = UserSession.CurrentUser.UserId,
                        created_on = DateTime.Now,
                        modified = false,
                        active = true,
                        priority = null,
                        locked = false,
                        locked_by = null,
                        locked_timestamp = null,
                        assigned_to = null,
                        list_source = ListSource,
                        modified_by = UserSession.CurrentUser.UserId,
                        modified_on = DateTime.Now
                    };

                    _efDbModel.sub_campaign_account_lists.AddObject(_item);
                }
                _efDbModel.SaveChanges();
            }
        }
开发者ID:,项目名称:,代码行数:36,代码来源:

示例3: btnAdd_Click

        private void btnAdd_Click(object sender, EventArgs e)
        {
            var atts = m_oSchedule.ContactAttendies;
            int[] rowHandles = gridView1.GetSelectedRows();
            if (rowHandles.Length > 0) {
                if (atts == null)
                    atts = new List<ContactAttendie>();
                for (int x = 0; x < rowHandles.Length; ++x) {
                    ContactAttendie att = gridView1.GetRow(rowHandles[x]) as ContactAttendie;
                    if (att != null) {
                        using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                            contact _eftContact = _efDbContext.contacts.FirstOrDefault(i => i.id == att.ContactID);
                            if (_eftContact != null) {
                                att.Email = _eftContact.email;
                                att.Address = string.Format("{0}{1}{2}{3}",
                                    string.IsNullOrEmpty(_eftContact.address_1) ? "" : _eftContact.address_1,
                                    string.IsNullOrEmpty(_eftContact.address_2) ? "" : " " + _eftContact.address_2,
                                    string.IsNullOrEmpty(_eftContact.city) ? "" : ", " + _eftContact.city,
                                    string.IsNullOrEmpty(_eftContact.country) ? "" : ", " + _eftContact.country
                                );
                                att.Telephone = _eftContact.direct_phone;
                                _efDbContext.Detach(_eftContact);
                            }
                        }

                        att.Attending = true;
                        atts.Add(att);
                    }
                }
            }
        }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例4: AddQuestion

 public AddQuestion(GridView oQuestionGrid, int question_id)
 {
     InitializeComponent();
     BPContext = new BrightPlatformEntities(UserSession.EntityConnection);
     QuestionID = question_id;
     QuestionGrid = oQuestionGrid;
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例5: LoadSIPAccount

 private void LoadSIPAccount()
 {
     objDbModel = new BrightPlatformEntities(UserSession.EntityConnection);
     gcSIPAccount.DataSource = null;
     var sipaccount = objDbModel.sip_accounts.AsQueryable();
     gcSIPAccount.DataSource = sipaccount;
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: AddAnswerForm

 public AddAnswerForm(int questionid, GridView sender)
 {
     InitializeComponent();
     question_id = questionid;
     gridviewSender = sender;
     BPContext = new BrightPlatformEntities(UserSession.EntityConnection);
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例7: SaveLanguage

 /// <sumamary>
 /// Save language
 /// </sumamary>
 public static int SaveLanguage(language objLanguage)
 {
     BrightPlatformEntities objBrightPlatformEntity = new BrightPlatformEntities(UserSession.EntityConnection);
     objBrightPlatformEntity.languages.AddObject(objLanguage);
     objBrightPlatformEntity.SaveChanges();
     return objLanguage.id;
 }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例8: CanDoCall

        public static bool CanDoCall()
        {
            BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection);
            int _UserId = UserSession.CurrentUser.UserId;
            var userAudio = _efDbContext.audio_settings.FirstOrDefault(i => i.user_id == _UserId);
            if(userAudio == null)
                return false;

            int _CallMode = userAudio.mode;
            if (_CallMode == 0) {
                user _item = _efDbContext.users.FirstOrDefault(i => i.id == UserSession.CurrentUser.UserId);
                if (_item.sip_id == null || Convert.ToInt32(_item.sip_id) < 1)
                    return false;
                else
                    return true;
            }
            return true;

            //int _UserId = UserSession.CurrentUser.UserId;
            //BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection);
            //user _efeUser = _efDbContext.users.Where(i => i.id == _UserId).FirstOrDefault();
            //if (_efeUser != null && _efeUser.sip_id != null && _efeUser.sip_id > 0) {
            //    var sipAccount = _efDbContext.sip_accounts.Where(e => e.id == _efeUser.sip_id).FirstOrDefault();
            //    if (sipAccount != null)
            //        return true;
            //}
            //return false;
        }
开发者ID:,项目名称:,代码行数:28,代码来源:

示例9: FrmMain_Load

        private void FrmMain_Load(object sender, EventArgs e)
        {
            //dummy values for question_id
            //int dropboxId = 1, textboxId = 2, multipleChoiceId = 3;
            BPContext = new BrightPlatformEntities(UserSession.EntityConnection);
            //var resourceList = BPContext.FIGetResources(3).ToList();
            //List<int?> resourceids = new List<int?>();
            //resourceList.ForEach(delegate(CTResources r) {
            //    resourceids.Add(r.resource_id);
            //});
            //var schedList = BPContext.schedules.Where(x => resourceids.Contains(x.resource_id)).ToList();

            this.layoutControlGroupQuestionnaire.BeginUpdate();

            ////add dropbox
            //Dropbox oDropbox = new Dropbox(this.layoutControlQuestionnaire);
            //oDropbox.ToolTipController = defaultToolTipController1;
            //oDropbox.Questionnaire = CampaignQuestionnaire.Instanciate(QuestionTypeConstants.Dropbox);
            ////oDropbox.Questionnaire = Business.BusinessAnswer.BindAnswer(oDropbox.Questionnaire, BPContext, dropboxId);
            //oDropbox.BindControls();
            //this.layoutControlGroupQuestionnaire.Add(oDropbox.ControlGroup);

            ////add textbox
            //Textbox oTextbox = new Textbox(this.layoutControlQuestionnaire);
            //oTextbox.Questionnaire = CampaignQuestionnaire.Instanciate(QuestionTypeConstants.Textbox);
            ////oTextbox.Questionnaire = Business.BusinessAnswer.BindAnswer(oTextbox.Questionnaire, BPContext, textboxId);
            //oTextbox.BindControls();
            //this.layoutControlGroupQuestionnaire.Add(oTextbox.ControlGroup);

            ////add multiplechoice
            Multiplechoice oMultipleChoice = new Multiplechoice(this.layoutControlQuestionnaire);
            oMultipleChoice.Questionnaire = CampaignQuestionnaire.Instanciate(QuestionTypeConstants.MultipleChoice);
            //oMultipleChoice.Questionnaire = Business.BusinessAnswer.BindAnswer(oMultipleChoice.Questionnaire, BPContext, multipleChoiceId);
            oMultipleChoice.BindControls();
            this.layoutControlGroupQuestionnaire.Add(oMultipleChoice.ControlGroup);

            //add schedule
            Schedule oSchedule = new Schedule(this.layoutControlQuestionnaire);
            oSchedule.Questionnaire = CampaignQuestionnaire.Instanciate(QuestionTypeConstants.Schedule);
            oSchedule.Questionnaire.Form.Settings.DataBindings.account_id = "1";
            //contact callerContact = BPContext.contacts.FirstOrDefault(x=>x.id == 35758);
            //if (callerContact != null)
            //    oSchedule.SetCurrentCaller(callerContact, 1);
            //oSchedule.ShowCalendarBookingClick += new EventHandler(oSchedule_ShowCalendarBookingClick);
            //oSchedule.Questionnaire = Business.BusinessAnswer.BindAnswer(oSchedule.Questionnaire, BPContext, multipleChoiceId);
            oSchedule.BindControls();
            this.layoutControlGroupQuestionnaire.Add(oSchedule.ControlGroup);

            //add seminar
            //Seminar oSeminar = new Seminar(this.layoutControlQuestionnaire);
            //oSeminar.Questionnaire = CampaignQuestionnaire.Instanciate(QuestionTypeConstants.Seminar);
            //oSeminar.Questionnaire.Form.Settings.DataBindings.account_id = "1";
            ////oSeminar.Questionnaire = Business.BusinessAnswer.BindAnswer(oSchedule.Questionnaire, BPContext, multipleChoiceId);
            //oSeminar.BindControls();
            //this.layoutControlGroupQuestionnaire.Add(oSeminar.ControlGroup);

            //add bottom spacer
            this.layoutControlGroupQuestionnaire.AddItem(emptySpaceItem1);
            this.layoutControlGroupQuestionnaire.EndUpdate();
        }
开发者ID:,项目名称:,代码行数:60,代码来源:

示例10: LogEventSMS

        public static void LogEventSMS(string pXML, string pMessage, string pComputerName, string pComputerIP, serverside_report_requests _eftRequest)
        {
            string Source = "BrightSales";
            string _Connection = ConfigurationManager.ConnectionStrings["DefaultEntityConnection"].ToString();
            int? requested_by = _eftRequest.requested_by;
            string[] _ids = _eftRequest.sub_campaign_ids.Split(',');
            string _SubCampaignIds = _ids[0];

            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(_Connection)) {
                _efDbContext.event_log.AddObject(new event_log() {
                    event_id = (int)EventLog.EventTypes.SEND_SMS,
                    user_id = requested_by,
                    subcampaign_id = int.Parse(_SubCampaignIds),
                    account_id = _eftRequest.account_id,
                    contact_id = null,
                    local_datetime = DateTime.Now,
                    computer_name = pComputerName,
                    param1 = pXML,
                    param2 = pMessage,
                    param3 = Source,
                    param4 = _eftRequest.account_id.ToString(),
                    param5 = pComputerIP,
                    param6 = null
                });

                _efDbContext.SaveChanges();
            }
        }
开发者ID:,项目名称:,代码行数:28,代码来源:

示例11: 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();
        }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例12: GetUsers

        public static IList<IdName> GetUsers(int FinalListId, bool pAddTeamEntry = false)
        {
            List<IdName> _lstData = new List<IdName>();
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                var objUsers = (
                    from objFinalList in _efDbContext.final_lists
                    join objSubCampaignUser in _efDbContext.subcampaign_users on objFinalList.sub_campaign_id equals objSubCampaignUser.subcampaign_id
                    join objUser in _efDbContext.users on objSubCampaignUser.user_id equals objUser.id
                    orderby objUser.fullname
                    select new IdName {
                        id = objUser.id,
                        name = objUser.fullname
                    }
                ).Distinct();

                var listResult = objUsers.ToList();
                IdName[] array = new IdName[listResult.Count];
                listResult.CopyTo(array);
                _lstData = array.ToList();
            }

            if (pAddTeamEntry)
                _lstData.Add(new IdName() {
                    id = 0,
                    name = "Team"
                });

            return _lstData;
        }
开发者ID:,项目名称:,代码行数:29,代码来源:

示例13: AddContactsToSubCampaign

        /// <summary>
        /// Add new contacts to an existing sub-campaign
        /// </summary>
        /// <param name="lstContactIds"></param>
        /// <param name="SubCampaignId"></param>
        public static void AddContactsToSubCampaign(List<int> lstContactIds, int SubCampaignId)
        {
            BrightPlatformEntities _efDbModel = new BrightPlatformEntities(UserSession.EntityConnection);
            int? _FinalListId = _efDbModel.final_lists.FirstOrDefault(i => i.sub_campaign_id == SubCampaignId).id;
            if (_FinalListId > 0)
            {
                foreach (int _ContactId in lstContactIds)
                {
                    sub_campaign_contact_lists _item = new sub_campaign_contact_lists()
                    {
                        final_list_id = (int)_FinalListId,
                        contact_id = _ContactId,
                        created_by = UserSession.CurrentUser.UserId,
                        created_on = DateTime.Now,
                        active = true,
                        modified = false,
                        priority = null,
                        in_list = false
                    };

                    _efDbModel.sub_campaign_contact_lists.AddObject(_item);
                }
                _efDbModel.SaveChanges();
            }
        }
开发者ID:,项目名称:,代码行数:30,代码来源:

示例14: FrmSchedulingPopup

 public FrmSchedulingPopup()
 {
     m_DoneLoadingBookings = false; // flag as not done loading yet
     InitializeComponent();
     this.KeyPreview = true;
     BPContext = new BrightPlatformEntities(UserSession.EntityConnection);
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例15: ManageReportTemplate

 public ManageReportTemplate(int viewid)
 {
     InitializeComponent();
     BPContext = new BrightPlatformEntities(UserSession.EntityConnection);
     reportDesign = new ReportUserDesigner();
     //BindSubcampaignLookup();
 }
开发者ID:,项目名称:,代码行数:7,代码来源:


注:本文中的BrightPlatformEntities类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。