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


C# BrightPlatformEntities.SaveChanges方法代码示例

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


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

示例1: 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,代码来源:

示例2: 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,代码来源:

示例3: 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,代码来源:

示例4: btnSave_Click

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbxSubject.Text)) {
                NotificationDialog.Information("Bright Manager", "Please specify a default send email suject.");
                return;
            }
            else if (string.IsNullOrEmpty(tbxMessage.Text)) {
                NotificationDialog.Information("Bright Manager", "Please specify a default send email message.");
                return;
            }

            /**
             * build the subject and message into one text only,
             * separated by a separator text "[sep]".
             */
            string _SendEmailConfig = string.Format("{0}[sep]{1}",
                tbxSubject.Text,
                tbxMessage.Text
            );

            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                subcampaign _eftSubCampaign = _efDbContext.subcampaigns.FirstOrDefault(i => i.id == m_SubCampaignId);
                if (_eftSubCampaign != null) {
                    //_eftSubCampaign.send_email_config = _SendEmailConfig;
                    _efDbContext.subcampaigns.ApplyCurrentValues(_eftSubCampaign);
                    _efDbContext.SaveChanges();
                    _efDbContext.Detach(_eftSubCampaign);
                }
            }

            NotificationDialog.Information("Bright Manager", "Saved send email config.");
            this.ParentForm.Close();
        }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例5: 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,代码来源:

示例6: 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,代码来源:

示例7: DeActivateContact

 /// <summary>
 /// De-activate a contact
 /// </summary>
 public static void DeActivateContact(int ContactId)
 {
     BrightPlatformEntities objBrightPlatformEntity = new BrightPlatformEntities(UserSession.EntityConnection);
     var objContact = objBrightPlatformEntity.contacts.Where(i => i.id == ContactId).Single();
     objContact.active = false;
     objContact.modified_date = DateTime.Now;
     objContact.modified_by = UserSession.CurrentUser.UserId;
     objBrightPlatformEntity.SaveChanges();
 }
开发者ID:,项目名称:,代码行数:12,代码来源:

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

示例9: SaveUpdatedLanguages

 /// <sumamary>
 /// Save languages
 /// </sumamary>
 public static void SaveUpdatedLanguages(List<LanguageInstance> objList)
 {
     BrightPlatformEntities objBrightPlatformEntity = new BrightPlatformEntities(UserSession.EntityConnection);
     foreach (LanguageInstance Item in objList)
     {
         var objItem = objBrightPlatformEntity.languages.Where(element => element.id == Item.id).FirstOrDefault();
         objItem.code = Item.code;
         objItem.name = Item.description;
         objBrightPlatformEntity.SaveChanges();
     }
 }
开发者ID:,项目名称:,代码行数:14,代码来源:

示例10: SaveUpdatedTitles

 /// <sumamary>
 /// Save titles
 /// </sumamary>
 public static void SaveUpdatedTitles(List<TitleInstance> objList)
 {
     BrightPlatformEntities objBrightPlatformEntity = new BrightPlatformEntities(UserSession.EntityConnection);
     foreach (TitleInstance Item in objList)
     {
         var objItem = objBrightPlatformEntity.titles.Where(element => element.id == Item.id).FirstOrDefault();
         objItem.language_id = Item.language_id;
         objItem.ssyk = Item.ssyk;
         objItem.date_created = Item.datecreated;
         objBrightPlatformEntity.SaveChanges();
     }
 }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例11: DeleteUser

        public static void DeleteUser(int UserId)
        {
            BrightPlatformEntities m_objBrightPlatformEntity = new BrightPlatformEntities(UserSession.EntityConnection);
            var objEntityUser = m_objBrightPlatformEntity.users.Where(objField => objField.id == UserId).SingleOrDefault();
            var objEntityUserComment = m_objBrightPlatformEntity.users_comments.Where(i => i.user_id == UserId).SingleOrDefault();

            m_objBrightPlatformEntity.users.DeleteObject(objEntityUser);

            if (objEntityUserComment != null)
                m_objBrightPlatformEntity.users_comments.DeleteObject(objEntityUserComment);

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

示例12: DeActivateCompany

 /// <summary>
 /// De-activate a company
 /// </summary>
 public static void DeActivateCompany(int AccountId, string Reason)
 {
     BrightPlatformEntities objBrightPlatformEntity = new BrightPlatformEntities(UserSession.EntityConnection);
     var objCompany = objBrightPlatformEntity.accounts.FirstOrDefault(i => i.id == AccountId) as account;
     if (objCompany != null) {
         //objCompany.active = false;
         objCompany.de_activate_reason = Reason;
         objCompany.modified_by = UserSession.CurrentUser.UserId;
         objCompany.modified_date = DateTime.Now;
         objCompany.de_activate_by = UserSession.CurrentUser.UserId; ;
         objCompany.de_activate_date = DateTime.Now;
         objBrightPlatformEntity.SaveChanges();
     }
 }
开发者ID:,项目名称:,代码行数:17,代码来源:

示例13: SaveMail

        public static long? SaveMail(string pXml, serverside_report_requests _eftRequest)
        {
            string _Connection = ConfigurationManager.ConnectionStrings["DefaultEntityConnection"].ToString();
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(_Connection)) {
                int? requested_by = _eftRequest.requested_by;

                string[] _ids = _eftRequest.sub_campaign_ids.Split(',');
                string _SubCampaignIds = _ids[0];

                message_log _eftMessageLog = new message_log() {
                    message_type = (int)SendMail.eMailType.Send_Mail_To_Prospect,
                    sub_campaign_id = int.Parse(_SubCampaignIds),
                    company_id = _eftRequest.account_id,
                    user_id = _eftRequest.requested_by,
                    XML = pXml,
                    created_date = DateTime.Now
                };
                _efDbContext.message_log.AddObject(_eftMessageLog);
                _efDbContext.SaveChanges();
                _efDbContext.Detach(_eftMessageLog);
                return _eftMessageLog.id;
            }
        }
开发者ID:,项目名称:,代码行数:23,代码来源:

示例14: PlayAudio

        public ActionResult PlayAudio(string pData)
        {
            /**
             * connection info.
             */
            #region Code Logic
            string _Connection = ConfigurationManager.ConnectionStrings["DefaultEntityConnection"].ToString();
            if (string.IsNullOrEmpty(_Connection))
                Response.Redirect(Url.RouteUrl(new { action = "DisplayError", pExceptionMessage = "No available connection. Please kindly contact your administrator." }));
            #endregion

            /**
             * user and request infos.
             */
            #region Code Logic
            serverside_report_requests _eftRequest = null;
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(_Connection)) {
                try {
                    Guid _id = new Guid(pData);
                    _eftRequest = _efDbContext.serverside_report_requests.FirstOrDefault(i => i.id == _id);
                    if (_eftRequest == null)
                        Response.Redirect(Url.RouteUrl(new { action = "DisplayError", pExceptionMessage = "Invalid web service request. Please kindly contact your administrator." }));

                    _eftRequest.processed = true;
                    _efDbContext.SaveChanges();
                    _efDbContext.Detach(_eftRequest);
                }
                catch {
                    Response.Redirect(Url.RouteUrl(new { action = "DisplayError", pExceptionMessage = "Invalid web service request. Please kindly contact your administrator." }));
                }
            }
            #endregion

            Stream stream = WebRequest.Create("https://lii.blob.core.windows.net/old/0a4b23f7-eab8-4043-ad84-36b4b5d23f1e_.mp3").GetResponse().GetResponseStream();
            return new FileStreamResult(stream, "audio/mpeg");
        }
开发者ID:,项目名称:,代码行数:36,代码来源:

示例15: SaveUserStatus

 public static void SaveUserStatus(int UserId, bool IsActivated)
 {
     BrightPlatformEntities m_objBrightPlatformEntity = new BrightPlatformEntities(UserSession.EntityConnection);
     var objEntityUser = m_objBrightPlatformEntity.users.Where(i => i.id == UserId).SingleOrDefault();
     //objEntityUser.disabled = Convert.ToByte(IsActivated);
     objEntityUser.disabled = IsActivated == true ? (byte)0 : (byte)1;
     objEntityUser.modified_date = DateTime.Now;
     objEntityUser.modified_by = UserSession.CurrentUser.UserId;
     m_objBrightPlatformEntity.SaveChanges();
 }
开发者ID:,项目名称:,代码行数:10,代码来源:


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