Exemple #1
0
        public static void Save(event_followup_log pData, bool pSaveExistingFollowUpCallsAsDone = false)
        {
            using (BrightPlatformEntities _eftDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                if (pSaveExistingFollowUpCallsAsDone) {
                    List<event_followup_log> _ToUpdateList = _eftDbContext.event_followup_log.Where(
                        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")
                    ).ToList();
                    if (_ToUpdateList.Count > 0) {
                        foreach (event_followup_log _item in _ToUpdateList) {
                            event_followup_log _handler = _eftDbContext.event_followup_log.FirstOrDefault(x => x.id == _item.id);
                            _item.done = true;
                            _eftDbContext.event_followup_log.ApplyCurrentValues(_item);
                            _eftDbContext.Detach(_handler);
                        }
                    }
                }

                _eftDbContext.event_followup_log.AddObject(pData);
                _eftDbContext.SaveChanges();
                _eftDbContext.Detach(pData);
            }
        }
Exemple #2
0
        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;
            }
        }
Exemple #3
0
        private void btnSaveCallLog_Click(object sender, EventArgs e)
        {
            if (tbxContactFirstname.Text.Length < 1 || tbxContactLastname.Text.Length < 1) {
                NotificationDialog.Information("Bright Sales", "Firstname / Lastname is required.");
                return;
            }
            else if (tbxContactFirstname.Text.Equals("First name") || tbxContactLastname.Text.Equals("Last name")) {
                NotificationDialog.Information("Bright Sales", "Firstname / Lastname is required.");
                return;
            }

            WaitDialog.Show("Saving data...");
            this.EndClock();
            m_EventBus.Notify<CallLogBarVoidEvent>(CallLogBarVoidEvent.EndCallInitiated);

            int? _ContactId = null;
            if (ContactPerson != null)
                if (ContactPerson.id > 0)
                    _ContactId = ContactPerson.id;

            string _ContactName = (string.Format("{0} {1}", tbxContactFirstname.Text, tbxContactLastname.Text)).Equals("Call Log") ? "Switchboard" : string.Format("{0} {1}", tbxContactFirstname.Text, tbxContactLastname.Text);
            event_followup_log newevent_followup_log = new event_followup_log() {
                            subcampaign_id = SubCampaignId,
                            account_id = AccountId,
                            contact_id = _ContactId,
                            title = tbxContactTitle.Text,
                            contact_no = CallLogBarParams.ContactNo,
                            short_message = tbxShortMessage.Text,
                            event_type = "Call Log",
                            event_status = cboCallStatus.Text,
                            date_of_transaction = DateTime.Now,
                            assigned_user = UserSession.CurrentUser.UserId,
                            done = true,
                            start_time = m_StartTime,
                            end_time = m_EndTime,
                            date_created = DateTime.Now,
                            created_by = UserSession.CurrentUser.UserId,
                            contact_name = _ContactName,
                            audio_id = m_AudioId
                        };
            BrightPlatformEntities m_efDbContext = new BrightPlatformEntities(UserSession.EntityConnection);
            m_efDbContext.event_followup_log.AddObject(newevent_followup_log);
            m_AudioId = Guid.Empty;

            bsProperty.CommonProperty.CallLogSaved = false;

            int id = newevent_followup_log.id;
            m_efDbContext.SaveChanges();
            m_EventBus.Notify(new PhoneCallSaveEventNotifier() {
                EventLogId = newevent_followup_log.id
            });

            this.Default();
            WaitDialog.Close();
        }
Exemple #4
0
        private void SetDaysFolder(event_followup_log followup)
        {
            var date = followup.date_created.Value;
            string year = date.Year.ToString();
            string month = date.Month.ToString();
            string days = date.Day.ToString();
            IFolder folder = null;
            if (!GetWebDavSession().OpenFolder(salesAudioUri).ItemExists(year))
               GetWebDavSession().OpenFolder(salesAudioUri).CreateFolder(year);

            if (!GetWebDavSession().OpenFolder(salesAudioUri +"/"+ year).ItemExists(month))
                GetWebDavSession().OpenFolder(salesAudioUri + "/" + year).CreateFolder(month);

            if (!GetWebDavSession().OpenFolder(salesAudioUri + "/" + year + "/" + month + "/").ItemExists(days))
               GetWebDavSession().OpenFolder(salesAudioUri + "/" + year + "/" + month + "/").CreateFolder(days);
        }
Exemple #5
0
        private void SetDaysFolder(event_followup_log followup, ref IFolder folder)
        {
            var date = followup.date_created.Value;
            string year = date.Year.ToString();
            string month = date.Month.ToString();
            string days = date.Day.ToString();

            if (folder.ItemExists(year))
                folder = folder.GetFolder(year);
            else
            {
                folder = folder.CreateFolder(year);
            }

            if (folder.ItemExists(month))
                folder = folder.GetFolder(month);
            else
                folder = folder.CreateFolder(month);

            if (folder.ItemExists(days))
                folder = folder.GetFolder(days);
            else
                folder = folder.CreateFolder(days);
        }
Exemple #6
0
        private void btnFollowupAdd_Click(object sender, EventArgs e)
        {
            if (SelectedContact == null || SelectedContact.id < 1) {
                NotificationDialog.Information("Bright Sales", "No selected contact for follow up.");
                return;
            } else if (cboFollowUpDate.Text.Length < 1) {
                NotificationDialog.Information("Bright Sales", "Please select a date.");
                return;
            }

            string _ContactName = (txtLogFirstName.Text + " " + txtLogLastname.Text).Equals("Call Log") ? "None" : txtLogFirstName.Text + " " + txtLogLastname.Text;
            event_followup_log objFollowUpData = new event_followup_log() {
                subcampaign_id = SubCampaignId,
                account_id = AccountId,
                contact_id = SelectedContact != null ? SelectedContact.id : 0,
                contact_no = m_sCalledPhoneNo,
                title = txtLogTitle.Text,
                event_type = cbFollowUpStatus.Text.Equals("Follow-Up Call") ? "Make Call" : "Send Mail",
                event_status = cbFollowUpStatus.Text,
                short_message = txtFollowUpShortMessage.Text,
                date_of_transaction = (DateTime)cboFollowUpDate.EditValue,
                start_time = TimeSpan.Parse(cboFollowUpTimeStart.EditValue.ToString()),
                end_time = TimeSpan.Parse(cboFollowUpTimeStart.EditValue.ToString()), // set as the same as end time will not apply for follow ups
                assigned_user = (int)cboFollowUpAssignedTo.EditValue,
                date_created = DateTime.Now,
                created_by = UserSession.CurrentUser.UserId,
                contact_name = SelectedContact.first_name + " " + SelectedContact.last_name
            };
            bool _SaveExistingFollowUpCallsAsDone = false;
            if (EventFollowUp.FollowUpCallExists(objFollowUpData))
            {
                DialogResult _dlg = MessageBox.Show(
                    "Follow-up call already exist for the current contact." + Environment.NewLine + Environment.NewLine + "Would you like to mark existing follow-up calls for this contact as done?",
                    "Bright Sales",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question
                );
                WaitDialog.Show(ParentForm, "Saving event follow-up...");
                if (_dlg == DialogResult.Yes)
                    _SaveExistingFollowUpCallsAsDone = true;
            }
            else
                WaitDialog.Show(ParentForm, "Saving event follow-up...");

            EventFollowUp.Save(objFollowUpData, _SaveExistingFollowUpCallsAsDone);

            if (onFollowUpLogSaving != null)
                onFollowUpLogSaving(sender, e);

            this.ResetCallViewFields();
            WaitDialog.Close();
        }
Exemple #7
0
        /// <summary>
        /// Save event follow
        /// </summary>
        private void SaveEventFollowUp()
        {
            //if (txtFollowUpShortMessage.Text.Length < 1 || txtFollowUpShortMessage.Text.Equals("Short Message (referral data etc)"))
            //{
            //    MessageBox.Show("Please enter a short message", "Event Follow-Up", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    txtFollowUpShortMessage.SelectAll();
            //    txtFollowUpShortMessage.Focus();
            //    return;
            //}

            WaitDialog.CreateWaitDialog("Saving event follow-up.");
            event_followup_log objFollowUpData = new event_followup_log()
            {
                subcampaign_id = oAppointment.SubCampaignId,
                account_id = oAppointment.AccountId,
                contact_id = m_oContactView.SelectedContact != null? m_oContactView.SelectedContact.id: 0,
                event_type = cbFollowUpStatus.Text.Equals("Follow-Up Call")? "Make Call": "Send Mail",
                event_status = cbFollowUpStatus.Text,
                short_message = txtFollowUpShortMessage.Text,
                date_of_transaction = (DateTime) cboFollowUpDate.EditValue,
                start_time = cboFollowUpTimeStart.Time.TimeOfDay,
                end_time = cboFollowUpTimeStart.Time.TimeOfDay, // set as the same as end time will not apply for follow ups
                assigned_user = (int) cboFollowUpAssignedTo.EditValue,
                date_created = DateTime.Now,
                created_by = UserSession.CurrentUser.UserId,
                contact_name = m_oContactView.SelectedContact.first_name + " " + m_oContactView.SelectedContact.last_name
            };

            EventFollowUp.Save(objFollowUpData);
            WaitDialog.CloseWaitDialog();
            WaitDialog.CreateWaitDialog("Populating event and follow up list view.");
            this.PopulateEventFollowUpView();
            this.InitializeFollowUpView();
            WaitDialog.CloseWaitDialog();
            MessageBox.Show("Successfully saved event follow up.", "Event Follow Up", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemple #8
0
        private void btnSaveCallLog_Click(object sender, EventArgs e)
        {
            if (tbxContactFirstname.Text.Length < 1 || tbxContactLastname.Text.Length < 1) {
                MessageBox.Show("Firstname / Lastname is required.", "Add Call Log", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            else if (tbxContactFirstname.Text.Equals("First name") || tbxContactLastname.Text.Equals("Last name")) {
                MessageBox.Show("Firstname / Lastname is required.", "Add Call Log", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            WaitDialog.Show("Saving data...");
            this.EndClock();
            if (EndCall_Initiated != null)
                EndCall_Initiated(this, new EventArgs());

            int? _ContactId = null;
            if (ContactPerson != null)
                if (ContactPerson.id > 0)
                    _ContactId = ContactPerson.id;

            string _ContactName = (string.Format("{0} {1}", tbxContactFirstname.Text, tbxContactLastname.Text)).Equals("Call Log") ? "Switchboard" : string.Format("{0} {1}", tbxContactFirstname.Text, tbxContactLastname.Text);
            event_followup_log newevent_followup_log = new event_followup_log() {
                            subcampaign_id = SubCampaignId,
                            account_id = AccountId,
                            contact_id = _ContactId,
                            title = tbxContactTitle.Text,
                            contact_no = CallLogBarParams.ContactNo,
                            short_message = tbxShortMessage.Text,
                            event_type = "Call Log",
                            event_status = cboCallStatus.Text,
                            date_of_transaction = DateTime.Now,
                            assigned_user = UserSession.CurrentUser.UserId,
                            done = true,
                            start_time = m_StartTime,
                            end_time = m_EndTime,
                            date_created = DateTime.Now,
                            created_by = UserSession.CurrentUser.UserId,
                            contact_name = _ContactName,
                            audio_id = m_AudioId
                        };
            m_efDbContext.event_followup_log.AddObject(newevent_followup_log);
            m_AudioId = Guid.Empty;
            m_CallLogSaved = true;
            int id = newevent_followup_log.id;
            m_efDbContext.SaveChanges();
            var args = new SaveCallLogArgs { Id = newevent_followup_log.id };
            if (btnSaveCallLog_OnClick != null)
                btnSaveCallLog_OnClick(sender, args);

            this.Default();
            WaitDialog.Close();
        }
Exemple #9
0
        private event_followup_log SaveCallLog(bool pIsSaved)
        {
            if (EndCall_Initiated != null)
                EndCall_Initiated(this, new EventArgs());

            if (StartTime.ToString().Equals("00:00:00"))
                EndTime = new TimeSpan();

            int? _ContactId = null;
            if (ContactPerson != null)
                if (ContactPerson.id > 0)
                    _ContactId = ContactPerson.id;

            string _CallMethod = string.Empty;
            if (m_CallMethod == SelectionProperty.CallMethod.Call_Board)
                _CallMethod = "Call Board";
            else if (m_CallMethod == SelectionProperty.CallMethod.Call_Direct)
                _CallMethod = "Call Direct";
            else if (m_CallMethod == SelectionProperty.CallMethod.Call_Mobile)
                _CallMethod = "Call Mobile";
            else if (m_CallMethod == SelectionProperty.CallMethod.Call_Anonymous)
                _CallMethod = "Call Anonymous";

            //if (AudioId.ToString().Equals("00000000-0000-0000-0000-000000000000")) {
            //    StartTime =
            //}

            string _ContactName = (string.Format("{0} {1}", tbxContactFirstname.Text, tbxContactLastname.Text)).Equals("Call Log") ? "Switchboard" : string.Format("{0} {1}", tbxContactFirstname.Text, tbxContactLastname.Text);
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                event_followup_log _efeCallLog = new event_followup_log() {
                    subcampaign_id = SubCampaignId,
                    account_id = AccountId,
                    contact_id = _ContactId,
                    title = tbxContactTitle.Text,
                    contact_no = CallLogBarParams == null ? "" : CallLogBarParams.ContactNo,
                    short_message = tbxShortMessage.Text,
                    event_type = "Call Log",
                    event_status = m_SelectedCallStatus, //cboCallStatus.Text,
                    date_of_transaction = DateTime.Now,
                    assigned_user = UserSession.CurrentUser.UserId,
                    done = true,
                    start_time = StartTime,
                    end_time = EndTime,
                    date_created = DateTime.Now,
                    created_by = UserSession.CurrentUser.UserId,
                    contact_name = _ContactName,
                    audio_id = AudioId,
                    is_saved = pIsSaved,
                    call_method = _CallMethod,
                    is_azure_blob = true

                };
                _efDbContext.event_followup_log.AddObject(_efeCallLog);
                _efDbContext.SaveChanges();
                return _efeCallLog;
            }
        }
Exemple #10
0
        private void GetUsers()
        {
            event_followup_log _item = new event_followup_log();
            List<CTSubCampaignUser> _lstItems = new List<CTSubCampaignUser>();
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                _item = _efDbContext.event_followup_log.FirstOrDefault(i => i.id == m_EventFollowUpLogId);
                _lstItems = _efDbContext.FIGetSubCampaignUsers(_item.subcampaign_id).ToList();
            }

            cboSubCampaignUsers.Properties.DataSource = null;
            cboSubCampaignUsers.Properties.Columns.Clear();
            cboSubCampaignUsers.Properties.DataSource = _lstItems;
            cboSubCampaignUsers.Properties.ValueMember = "id";
            cboSubCampaignUsers.Properties.DisplayMember = "fullname";
            cboSubCampaignUsers.Properties.Columns.Add(new LookUpColumnInfo("fullname"));
            cboSubCampaignUsers.EditValue = _item.assigned_user;
        }
Exemple #11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cboContact.EditValue == null) {
                NotificationDialog.Information("Bright Sales", "No selected contact for follow up.");
                return;
            }
            else if (dbxDate.Text.Length < 1) {
                NotificationDialog.Information("Bright Sales", "Please select a date.");
                return;
            }
            else if (m_ContactPersons == null) {
                NotificationDialog.Information("Bright Sales", "No selected contact for follow up.");
                return;
            }

            WaitDialog.Show(ParentForm, "Saving data ...");
            string _ContactEventType = "Todo";
            if (Convert.ToInt32(icboEventType.EditValue) > 0)
                _ContactEventType = "Nurture Event";
            else if (icboEventType.Text.Equals("Call Back"))
                _ContactEventType = "Make Call";
            else if (icboEventType.Text.Equals("Follow-Up Mail"))
                _ContactEventType = "Send Mail";

            int _ContactId = Convert.ToInt32(cboContact.EditValue);
            CTScSubCampaignContactList _SelectedContact = m_ContactPersons.Find(i => i.id == _ContactId);
            event_followup_log objFollowUpData = null;
            if (_SelectedContact == null) {
                WaitDialog.Close();
                NotificationDialog.Information("Bright Sales", "No selected contact for follow up.");
                return;
            }

            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection) { CommandTimeout = 0 }) {
                objFollowUpData = _efDbContext.event_followup_log.FirstOrDefault(i => i.id == FollowUpId);
                if (objFollowUpData == null) {
                    objFollowUpData = new event_followup_log() {
                        account_id = AccountId,
                        date_created = DateTime.Now,
                        created_by = UserSession.CurrentUser.UserId
                    };

                    if (Convert.ToInt32(icboEventType.EditValue) > 0)
                        objFollowUpData.subcampaign_id = Convert.ToInt32(icboEventType.EditValue);
                    else
                        objFollowUpData.subcampaign_id = SubCampaignId;
                }

                objFollowUpData.date_of_transaction = Convert.ToDateTime(dbxDate.EditValue);
                objFollowUpData.start_time = TimeSpan.Parse(cboTime.EditValue.ToString());
                objFollowUpData.end_time = TimeSpan.Parse(cboTime.EditValue.ToString()); // set as the same as end time will not apply for follow ups
                objFollowUpData.contact_id = _SelectedContact.id;
                objFollowUpData.contact_no = string.Empty; //cboContactNo.Text;
                objFollowUpData.title = _SelectedContact.title;
                objFollowUpData.event_type = _ContactEventType;
                objFollowUpData.event_status = icboEventType.Text; //cboStatus.Text;
                objFollowUpData.short_message = tbxRemarks.Text;
                objFollowUpData.assigned_user = Convert.ToInt32(cboSalesUser.EditValue);
                objFollowUpData.done = cbxDone.Checked;
                objFollowUpData.is_saved = true;

                var _item = m_ContactPersons.Find(i => i.id == _SelectedContact.id);
                if (_item != null)
                    objFollowUpData.contact_name = string.Format("{0} {1}", _item.first_name, _item.last_name);

                if (Convert.ToInt32(icboEventType.EditValue) > 0)
                    objFollowUpData.source_sub_campaign_id = SubCampaignId;

                /**
                 * new event log.
                 */
                if (FollowUpId < 1) {
                    bool _SaveExistingFollowUpCallsAsDone = false;
                    if (EventFollowUp.FollowUpCallExists(objFollowUpData)) {
                        WaitDialog.Close();
                        DialogResult _dlg = MessageBox.Show(
                            string.Format("Follow-up call already exist for the current contact.{0}Would you like to mark existing follow-up calls for this contact as done?", Environment.NewLine),
                            "Bright Sales",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Question
                        );
                        _SaveExistingFollowUpCallsAsDone = true;
                        if (_dlg == DialogResult.No)
                            _SaveExistingFollowUpCallsAsDone = false;

                        WaitDialog.Show(ParentForm, "Saving data ...");
                    }

                    // save the usual event log first
                    EventFollowUp.Save(objFollowUpData, _SaveExistingFollowUpCallsAsDone);

                    /**
                     * if nurture event, copy existing event follow up log to another object, for use in inserting nurture log.
                     * https://brightvision.jira.com/secure/attachment/14513/2012-11-19_2227.png
                     * https://docs.google.com/a/myndconsulting.com/spreadsheet/ccc?key=0Av2stuK1YKUAdFBwemdzOGdlaVdrYnY1VHQ4Rm1LRUE#gid=0
                     */
                    #region ===== Nurture Sub Campaign Accounts & Contacts Insert Handling =====

                    if (Convert.ToInt32(icboEventType.EditValue) > 0) {

                        /**
                         * insert nurture event log
                         */
                        event_followup_log _NurtureLog = new event_followup_log() {
                            subcampaign_id = SubCampaignId, //objFollowUpData.subcampaign_id,
                            account_id = objFollowUpData.account_id,
                            contact_id = objFollowUpData.contact_id,
                            title = objFollowUpData.title,
                            event_type = "Nurture Log",
                            event_status = objFollowUpData.event_status,
                            date_created = objFollowUpData.date_created,
                            start_time = objFollowUpData.start_time,
                            end_time = objFollowUpData.end_time,
                            created_by = objFollowUpData.created_by,
                            date_of_transaction = objFollowUpData.date_of_transaction,
                            contact_name = objFollowUpData.contact_name,
                            contact_no = objFollowUpData.contact_no,
                            is_saved = objFollowUpData.is_saved,
                            nurture_event_followup_log_id = objFollowUpData.id,
                            assigned_user = null,
                            done = false,
                            total_tries = 0,
                            source_sub_campaign_id = null
                        };
                        EventFollowUp.Save(_NurtureLog, false);

                        /**
                         * we will only insert current account not existing in the nurture sub-campaign.
                         */
                        int _SubCampaignId = Convert.ToInt32(icboEventType.EditValue);
                        int _FinalListId = (int)_efDbContext.final_lists.FirstOrDefault(i => i.sub_campaign_id == _SubCampaignId).id;
                        sub_campaign_account_lists _NurtureSubCampaignAccount = _efDbContext.sub_campaign_account_lists.FirstOrDefault(i =>
                            i.final_list_id == _FinalListId &&
                            i.account_id == AccountId &&
                            i.active == true
                        );

                        /**
                         * we will only insert account if not existing in the nurture sub-campaign.
                         */
                        if (_NurtureSubCampaignAccount == null) {
                            _efDbContext.sub_campaign_account_lists.AddObject(new sub_campaign_account_lists() {
                                final_list_id = _FinalListId,
                                account_id = AccountId,
                                assigned_to = cboSalesUser.Text,
                                list_source = this.GetListSource(new GetListSourceArgs() { CompanyId = AccountId, ContactId = 0 }),
                                active = true,
                                created_by = UserSession.CurrentUser.UserId,
                                created_on = DateTime.Now,
                                modified_by = UserSession.CurrentUser.UserId,
                                modified_on = DateTime.Now
                            });
                            _efDbContext.SaveChanges();
                        }
                        else
                            _efDbContext.Detach(_NurtureSubCampaignAccount);

                        /**
                         * we will only insert current account's contacts not existing in the nurture sub-campaign.
                         * we will loop each contact and check if its already existing in the nurture sub-campaign.
                         */
                        List<CTScSubCampaignContactList> _lstContacts = ObjectSubCampaign.GetSubCampaignContacts(SubCampaignId, AccountId, m_FinalListId);
                        if (_lstContacts.Count > 0) {
                            foreach (CTScSubCampaignContactList _efoContact in _lstContacts) {
                                sub_campaign_contact_lists _efoExistingContact = _efDbContext.sub_campaign_contact_lists.FirstOrDefault(i =>
                                    i.final_list_id == _FinalListId &&
                                    i.contact_id == _efoContact.id
                                );

                                /**
                                 * do not insert if contact is existing.
                                 */
                                if (_efoExistingContact != null) {
                                    _efDbContext.Detach(_efoExistingContact);
                                    continue;
                                }

                                /**
                                 * insert contact to nurture sub-campaign.
                                 */
                                _efDbContext.sub_campaign_contact_lists.AddObject(new sub_campaign_contact_lists() {
                                    final_list_id = _FinalListId,
                                    contact_id = _efoContact.id,
                                    in_list = (_efoContact.id == Convert.ToInt32(cboContact.EditValue))? true: false,
                                    active = _efoContact.active,
                                    list_source = (_efoContact.id == Convert.ToInt32(cboContact.EditValue))? this.GetListSource(new GetListSourceArgs() { CompanyId = 0, ContactId = _efoContact.id }): string.Empty,
                                    created_by = UserSession.CurrentUser.UserId,
                                    created_on = DateTime.Now,
                                    modified_by = UserSession.CurrentUser.UserId,
                                    modified_on = DateTime.Now
                                });
                            }
                            _efDbContext.SaveChanges();
                        }
                    }
                    #endregion

                    this.Default();
                    if (btnSave_OnClick != null)
                        btnSave_OnClick(sender, new EventFollowUpLogEvents.OnSaveArguments());

                    WaitDialog.Close();
                    this.ParentForm.Hide();
                }

                /**
                 * edit event log.
                 */
                else {
                    _efDbContext.event_followup_log.ApplyCurrentValues(objFollowUpData);
                    _efDbContext.SaveChanges();
                    if (btnSave_OnClick != null)
                        btnSave_OnClick(sender, new EventFollowUpLogEvents.OnSaveArguments() {
                            EventLog = objFollowUpData
                        });

                    WaitDialog.Close();
                    this.ParentForm.Close();
                }
            }
        }
Exemple #12
0
 public void SetCampaignInfo(event_followup_log pArgs)
 {
     using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
         account _efoCompany = _efDbContext.accounts.FirstOrDefault(i => i.id == pArgs.account_id);
         lblCompanyInfo.Text = string.Format("Company: {0}{1}",
             _efoCompany.company_name,
             string.IsNullOrEmpty(_efoCompany.city) ? string.Empty : ", " + _efoCompany.city
         );
         tbxRemarks.Text = pArgs.short_message;
         cbxDone.Checked = pArgs.done;
         lciHide.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         lciClear.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         cboContact.EditValue = pArgs.contact_id;
         dbxDate.EditValue = pArgs.date_of_transaction;
         cboTime.Text = string.Format("{0}:{1}", ((TimeSpan)pArgs.start_time).Hours.ToString().PadLeft(2, '0'), ((TimeSpan)pArgs.start_time).Minutes.ToString().PadLeft(2, '0'));
         FollowUpId = pArgs.id;
         _efDbContext.Detach(_efoCompany);
     }
 }