Beispiel #1
0
        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;
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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);
                }
            }
        }
Beispiel #4
0
        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();
        }
Beispiel #5
0
 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);
         }
     }
 }
Beispiel #6
0
        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);
        }
Beispiel #7
0
 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();
 }
Beispiel #8
0
 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;
 }
Beispiel #9
0
 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);
         }
     }
 }
Beispiel #10
0
        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;
        }
Beispiel #11
0
        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;
        }
Beispiel #12
0
        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>";
            }
        }
Beispiel #13
0
        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 = _eftSipAccount.@operator;
                    memoEditComment.EditValue = _eftSipAccount.comment;
                }
            }
        }
Beispiel #14
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;
            }
        }
Beispiel #15
0
 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;
 }
Beispiel #16
0
        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();
                }
            }
        }
Beispiel #17
0
        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;
            }
        }
Beispiel #18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (tbxReportTemplateName.Text.Length < 1)
                return;

            using (BrightPlatformEntities _efDbModel = new BrightPlatformEntities(UserSession.EntityConnection)) {
                if (_efDbModel.additional_data_report_templates.FirstOrDefault(i => i.template_name.Equals(tbxReportTemplateName.Text)) != null) {
                    MessageBox.Show("Report template name already exists.", "Bright Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                var defaultTemplate = _efDbModel.additional_data_report_templates.FirstOrDefault(i => i.is_default);
                if (defaultTemplate == null) {
                    defaultTemplate = new additional_data_report_templates();
                    defaultTemplate.layout_config = string.Empty;
                    defaultTemplate.data_config = string.Empty;
                }
                WaitDialog.Show("Saving new data.");
                additional_data_report_templates _item = new additional_data_report_templates() {
                    template_name = tbxReportTemplateName.Text,
                    created_on = DateTime.Now,
                    created_by = UserSession.CurrentUser.UserId,
                    layout_config = defaultTemplate.layout_config
                };
                _efDbModel.additional_data_report_templates.AddObject(_item);
                _efDbModel.SaveChanges();

                if (AfterSave != null)
                    AfterSave(this, new AddReportTemplateArgs() { ReportTemplateId = _item.id });

                if (_item != null)
                    _efDbModel.Detach(_item);
            }

            WaitDialog.Close();
            this.ParentForm.Close();
        }
Beispiel #19
0
        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");
        }
Beispiel #20
0
        private void cbxActive_EditValueChanging(object sender, ChangingEventArgs e)
        {
            if (m_BrightSalesProperty.CampaignBooking.Mode == SelectionProperty.CampaignBookingMode.Browse) {
                e.Cancel = true;
                return;
            }

            m_ContactForUpdateRowHandle = gvContact.FocusedRowHandle;
            CheckEdit _objCheckBox = sender as CheckEdit;
            if (!_objCheckBox.Checked)
                return;

            bool _editable = true;
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                final_lists _item = _efDbContext.final_lists.FirstOrDefault(i => i.sub_campaign_id == m_BrightSalesProperty.CommonProperty.SubCampaignId);
                if (_item == null)
                    _editable = false;
                else {
                    _efDbContext.Detach(_item);
                    sub_campaign_account_lists _eftCurrentCompany = _efDbContext.sub_campaign_account_lists.FirstOrDefault(
                        i => i.final_list_id == _item.id && i.account_id == m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId
                    );
                    if (_eftCurrentCompany != null) {
                        if (_eftCurrentCompany.locked_by != UserSession.CurrentUser.UserId)
                            _editable = false;

                        _efDbContext.Detach(_eftCurrentCompany);
                    }
                }
            }

            if (!_editable) {
                NotificationDialog.Information("Bright Sales", "Currently worked by another user.");
                return;
            }

            string Message = String.Format("This is a global deletion from all campaigns.{0}Are you sure you want to de-activate this contact?", Environment.NewLine);
            DialogResult _dlg = MessageBox.Show(Message, "Bright Sales", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (_dlg == DialogResult.No)
                e.Cancel = true;
            else
                e.Cancel = false;
        }
Beispiel #21
0
        /// <summary>
        ///It initializes a softphone object with a SIP BPX, and it is for requisiting a SIP account that is nedded for a SIP PBX service. It registers this SIP
        ///account to the SIP PBX through an ’IphoneLine’ object which represents the telephoneline. 
        ///If the telephone registration is successful we have a call ready softphone. In this example the softphone can be reached by dialing the number 891.
        /// </summary>
        private void InitializeSoftPhone()
        {
            try
            {
                if (Ozeki.VoIP.SDK.Protection.LicenseManager.Instance.LicenseType != Ozeki.VoIP.SDK.Protection.LicenseType.Activated)
                    Ozeki.VoIP.SDK.Protection.LicenseManager.Instance.SetLicense(m_OzekiLicenseId, m_OzekiLicenseKey);

                using (BrightPlatformEntities objDbModel = new BrightPlatformEntities(UserSession.EntityConnection)) {
                    int? _SipAcctId = objDbModel.users.FirstOrDefault(i => i.id == UserSession.CurrentUser.UserId).sip_id;
                    if (!_SipAcctId.HasValue) {
                        //MessageBox.Show(
                        //    string.Format("Your account is not yet configured for calling.{0}Please contact your administrator.", Environment.NewLine),
                        //    "Bright Sales",
                        //    MessageBoxButtons.OK,
                        //    MessageBoxIcon.Information
                        //);
                        BrightVision.Common.UI.NotificationDialog.Error(
                            "Bright Sales",
                            string.Format("Your account is not yet configured for calling.{0}Please contact your administrator.", Environment.NewLine)
                        );
                        return;
                    }

                    sip_accounts sip = objDbModel.sip_accounts.FirstOrDefault(i => i.id == _SipAcctId);
                    if (sip != null)
                        objDbModel.Detach(sip);

                    if (m_UserAudioSetting == null)
                        m_UserAudioSetting = AudioSettingUtility.GetUserAudioSetting();

                    m_UserMicrophone = AudioSettingUtility.GetDefaultDeviceMicrophone();
                    m_UserSpeaker = AudioSettingUtility.GetDefaultDeviceSpeaker();
                    m_UserMicrophone.Volume = (float)m_UserAudioSetting.mic_volume / 10;
                    m_UserSpeaker.Volume = (float)m_UserAudioSetting.speaker_volume / 10;

                    try {
                        softPhone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5700, 5750, 5780);
                    }
                    catch {
                    }

                    this.DisableUnwantedCodec();
                    softPhone.IncomingCall -= new EventHandler<VoIPEventArgs<IPhoneCall>>(softPhone_IncomingCall);
                    softPhone.IncomingCall += new EventHandler<VoIPEventArgs<IPhoneCall>>(softPhone_IncomingCall);
                    SIPAccount acc = new SIPAccount(
                       true,
                       sip.display_name.Trim(),
                       sip.username.Trim(),
                       sip.username.Trim(),
                       sip.password,
                       sip.sip_url.Trim(),
                       5060,
                       ""
                    );
                    // var acc = new SIPAccount(true, sip.display_name, sip.username, sip.username, sip.password, sip.sip_url, 5060,"");
                    //  NatConfiguration newNatConfiguration = new NatConfiguration(NatTraversalMethod.Auto, new NatRemoteServer("stun.ozekiphone.com", "", ""));
                    phoneLine = softPhone.CreatePhoneLine(acc, Ozeki.Network.TransportType.Udp, SRTPMode.None);
                    phoneLine.PhoneLineStateChanged -= new EventHandler<VoIPEventArgs<PhoneLineState>>(phoneLine_PhoneLineInformation);
                    phoneLine.PhoneLineStateChanged += new EventHandler<VoIPEventArgs<PhoneLineState>>(phoneLine_PhoneLineInformation);
                    softPhone.RegisterPhoneLine(phoneLine);
                    objDbModel.Dispose();
                }
            }
            catch (Exception ex) {
            }
        }
Beispiel #22
0
        private void btnEditFollowUpDetails_Click(object sender, EventArgs e)
        {
            if (EventId < 1)
            {
                NotificationDialog.Error("Bright Sales", "No editable data is available.");
                return;
            }

            m_EventBus.Notify(new FollowUpBarEvents.GetCampaignBookingArgs() {
                ForWorkModePurpose = false
            });

            //CampaignBookingProperty.CampaignBoookingArguments _args = GetCampaignBookingArgs(false);
            if (m_BrightSalesProperty.EventsProperty.CampaignBookingArgs == null || m_BrightSalesProperty.EventsProperty.CampaignBookingArgs.oAppointment == null)
                return;

            WaitDialog.Show("Loading Data ...");
            #region Initialize Editor
            m_Editor = new FollowUpEditor() {
                Dock = DockStyle.Fill,
                IsNurtureEvent = false
            };
            m_Editor.btnSave_OnClick += new FollowUpEditor.btnSaveOnClickEventHandler(m_Editor_btnSave_OnClick);
            m_dlgEditor = new PopupDialog() {
                FormBorderStyle = FormBorderStyle.FixedSingle,
                MinimizeBox = false,
                MaximizeBox = false,
                StartPosition = FormStartPosition.CenterScreen,
                Text = "Edit Current Follow Up",
                ClientSize = new Size(m_Editor.Width + 2, m_Editor.Height + 2),
                CloseBox = false
            };
            m_dlgEditor.Controls.Add(m_Editor);
            #endregion

            CampaignBookingProperty.CampaignBoookingArguments _args = m_BrightSalesProperty.EventsProperty.CampaignBookingArgs;
            //bool IsDeActivated = false;
            int _FinalListId;
            event_followup_log _data;
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                _data = _efDbContext.event_followup_log.FirstOrDefault(i => i.id == _args.Id);
                _FinalListId = (int)_efDbContext.final_lists.FirstOrDefault(i => i.sub_campaign_id == _data.subcampaign_id).id;
                _efDbContext.Detach(_data);

                /*
                 * https://brightvision.jira.com/browse/PLATFORM-3070
                 * DAN: Inrelated to fixing the issue as must not be able to edit when account is already deactivated.
                 */
                sub_campaign_account_lists _eftSubCampaignAccount = _efDbContext.sub_campaign_account_lists.FirstOrDefault(p =>
                   p.account_id == _data.account_id &&
                   p.final_list_id == _FinalListId &&
                   p.active == true
                );

                if (_eftSubCampaignAccount == null) {
                    NotificationDialog.Warning("Bright Sales", "This account has been de-activated");
                    WaitDialog.Close();
                    return;
                }

                _efDbContext.Detach(_eftSubCampaignAccount);

                //if (_eftSubCampaignAccount != null)
                //    _efDbContext.Detach(_eftSubCampaignAccount);
                //else
                //    IsDeActivated = true;
            }

            //if (IsDeActivated)
            //{
            //    NotificationDialog.Warning("Bright Sales", "This account has been de-activated");
            //    //return;
            //}

            if (_data.event_type.Equals("Nurture Event"))
                m_Editor.IsNurtureEvent = true;

            m_Editor.SubCampaignId = _args.oAppointment.SubCampaignId;
            m_Editor.AccountId = _args.oAppointment.AccountId;
            m_Editor.Prepare();

            if (!_data.event_type.Equals("Nurture Event")) {
                m_Editor.GetEventTypes(0, _data.event_type);
                m_Editor.LoadSalesUsers((int)_data.subcampaign_id, (int)((_data.assigned_user != null)?_data.assigned_user:0));
                m_Editor.SetCampaignInfo(_args);
                m_ContactList = ObjectSubCampaign.GetSubCampaignContacts(_args.oAppointment.SubCampaignId, _args.oAppointment.AccountId, _args.oAppointment.FinalListId);
            }
            else {
                m_Editor.GetEventTypes((int)_data.source_sub_campaign_id);
                m_Editor.SetSelectedEventType((int)_data.subcampaign_id);
                m_Editor.LoadSalesUsers((int)_data.subcampaign_id, (int)_data.assigned_user);
                m_Editor.SetCampaignInfo(_data);
                m_ContactList = ObjectSubCampaign.GetSubCampaignContacts((int)_data.subcampaign_id, (int)_data.account_id, _FinalListId);
            }

            if (m_ContactList.Count > 0) {
                m_Editor.LoadContactPersons(m_ContactList);
                CTScSubCampaignContactList _contact = m_ContactList.Find(i => i.id == (int)_data.contact_id);
                if (_contact != null) {
                    m_Editor.ContactPerson = _contact;
                    m_Editor.LoadSelectedContact(false);
                }
            }

            WaitDialog.Close();
            m_dlgEditor.ShowDialog(this);
        }
Beispiel #23
0
        //public static bool ValidateUserLogin(int UserId, string Password)
        public static bool ValidateUserLogin(string pEmail, string pPassword, ref user efoUser)
        {
            user _efoUser;
            using (BrightPlatformEntities m_objBrightPlatformEntity = new BrightPlatformEntities(UserSession.DefaultEntityConnection)) {
                pPassword = HashUtility.GetHashPassword(pPassword);
                _efoUser = m_objBrightPlatformEntity.users.FirstOrDefault(i => i.email == pEmail && i.password.Equals(pPassword) && i.internal_user == true);
                if (_efoUser != null) {
                    efoUser = _efoUser;
                    m_objBrightPlatformEntity.Detach(_efoUser);
                }
            }

            if (_efoUser != null)
                return true;
            else
                return false;
        }
Beispiel #24
0
        public static bool SaveUserPassword(string pEmail, string pNewPassword)
        {
            var _Connection = UserSession.DefaultEntityConnection;
            if (_Connection == null)
                return false;

            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(_Connection)) {
                user _eftUser = _efDbContext.users.FirstOrDefault(i => i.email == pEmail && i.internal_user == true);
                if (Convert.ToBoolean(_eftUser.disabled)) {
                    _efDbContext.Detach(_eftUser);
                    return false;
                }

                if (_eftUser != null) {
                    _efDbContext.change_password_logs.AddObject(new change_password_logs() {
                        user_id = _eftUser.id,
                        old_password = _eftUser.password,
                        new_password = pNewPassword,
                        updated_by = _eftUser.id,
                        updated_on = DateTime.Now
                    });
                    _eftUser.password = HashUtility.GetHashPassword(pNewPassword);
                    _efDbContext.SaveChanges();
                    _efDbContext.Detach(_eftUser);
                }
                else
                    return false;
            }

            return true;
        }
Beispiel #25
0
        /// <summary>
        /// Function to save user data
        /// </summary>
        public static int SaveUser(bool isNew, UserInstance objParams, bool hasChangedPassword)
        {
            user objEntityUser = null;
            using (BrightPlatformEntities m_objBrightPlatformEntity = new BrightPlatformEntities(UserSession.EntityConnection)) {
                objEntityUser = m_objBrightPlatformEntity.users.CreateObject();
                if (!isNew) {
                    objEntityUser = null;
                    objEntityUser = m_objBrightPlatformEntity.users.Where(i => i.id == objParams.id).FirstOrDefault();
                }
                else {
                    objEntityUser.created_by = UserSession.CurrentUser.UserId;
                    objEntityUser.created_date = DateTime.Now;
                }

                string _OldPassword = objEntityUser.password;

                objEntityUser.fullname = objParams.full_name;
                //objEntityUser.last_name = objParams.last_name;
                objEntityUser.title = objParams.title;
                objEntityUser.reports_to = Convert.ToInt16(objParams.reports_to);
                objEntityUser.site = objParams.site;
                objEntityUser.disabled = Convert.ToInt16(objParams.active == true ? 0 : 1);
                objEntityUser.sip_id = objParams.sip_id;
                objEntityUser.phone1 = objParams.phone;
                objEntityUser.mobile_no = objParams.mobile;
                objEntityUser.email = objParams.email;
                objEntityUser.username = objParams.username;
                objEntityUser.internal_user = objParams.internal_user;
                objEntityUser.modified_by = UserSession.CurrentUser.UserId;
                objEntityUser.modified_date = DateTime.Now;

                if (hasChangedPassword)
                    objEntityUser.password = HashUtility.GetHashPassword(objParams.password);

                if (isNew)
                    m_objBrightPlatformEntity.users.AddObject(objEntityUser);

                m_objBrightPlatformEntity.change_password_logs.AddObject(new change_password_logs() {
                    user_id = objParams.id,
                    new_password = objParams.password,
                    old_password = _OldPassword,
                    updated_by = UserSession.CurrentUser.UserId,
                    updated_on = DateTime.Now
                });

                m_objBrightPlatformEntity.SaveChanges();
                m_objBrightPlatformEntity.Detach(objEntityUser);
            }
            return objEntityUser.id;
        }
Beispiel #26
0
        /// <summary>
        /// Determines if the user is a brightvision customer user
        /// </summary>
        /// <param name="UserId"></param>
        /// <param name="SubcampaignId"></param>
        /// <returns></returns>
        public static bool IsCustomerUser(int UserId, int SubcampaignId)
        {
            //3 = Sub Campaign Sales
            BrightPlatformEntities objDbModel = new BrightPlatformEntities(UserSession.EntityConnection);
            var iUser =
            (
                from objUserRole in objDbModel.sub_campaign_user_roles
                join objSubCampaignUser in objDbModel.subcampaign_users on objUserRole.sub_campaign_user_id equals objSubCampaignUser.id
                where objSubCampaignUser.user_id == UserId && objUserRole.sub_campaign_role_id == 4 && objSubCampaignUser.subcampaign_id == SubcampaignId
                select objUserRole

            ).FirstOrDefault();

            if (iUser != null)
            {
                objDbModel.Detach(iUser);
                return true;
            }
            else
            {
                return false;
            }
        }
Beispiel #27
0
 private void GetDefaultConfig()
 {
     using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
         subcampaign _eftSubCampaign = _efDbContext.subcampaigns.FirstOrDefault(i => i.id == m_SubCampaignId);
         if (_eftSubCampaign != null) {
             //if (!string.IsNullOrEmpty(_eftSubCampaign.send_email_config)) {
             //    string[] _data = _eftSubCampaign.send_email_config.Split(new string[] { "[sep]" }, StringSplitOptions.None);
             //    tbxSubject.Text = _data[0];
             //    tbxMessage.Text = _data[1];
             //}
             _efDbContext.Detach(_eftSubCampaign);
         }
     }
 }
Beispiel #28
0
        private void btnSaveToContact_Click(object sender, EventArgs e)
        {
            try
            {
                bool _editable = true;
                using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection))
                {
                    sub_campaign_account_lists _eftCurrentCompany = _efDbContext.sub_campaign_account_lists.FirstOrDefault(i => i.final_list_id == m_BrightSalesProperty.CommonProperty.FinalListId && i.account_id == m_BrightSalesProperty.CommonProperty.AccountId);
                    if (_eftCurrentCompany != null)
                    {
                        if (_eftCurrentCompany.locked_by != null && _eftCurrentCompany.locked_by != UserSession.CurrentUser.UserId)
                            _editable = false;

                        _efDbContext.Detach(_eftCurrentCompany);
                    }
                }

                if (!_editable)
                {
                    NotificationDialog.Error("Bright Sales", "Currently worked by another user.");
                    return;
                }

                if (txtAddressBar.Text.Trim() == "" && BrightVision.Common.Utilities.ValidationUtility.IFNullString(wbLinkedIn.Url, "").Contains("/profile/view?id="))
                    txtAddressBar.Text = wbLinkedIn.Url.ToString();

                if (!CheckValidURL(txtAddressBar.Text))
                {
                    NotificationDialog.Error("Error", "Invalid URL");
                    return;
                }

                using (BrightPlatformEntities _efDbCOntext = new BrightPlatformEntities(UserSession.EntityConnection))
                {
                    contact _eftContacts = _efDbCOntext.contacts.FirstOrDefault(i => i.id == m_contactId);
                    if (_eftContacts != null)
                    {
                        _eftContacts.linkedin_url = txtAddressBar.Text;
                    }
                    _efDbCOntext.SaveChanges();

                    _efDbCOntext.Detach(_eftContacts);

                    m_linkedin = txtAddressBar.Text;
                    btnLoadContact.Enabled = true;

                    if (m_BrightSalesProperty.CommonProperty.CurrentTab == SelectionProperty.CurrentTab.CampaignBooking)
                    {
                        m_EventBus.Notify(new LinkedInEvents.OnSave.ManageCampaignBooking()
                        {
                            OnSaveArgs = new LinkedInEvents.LinkedInArgs()
                            {
                                LinkedInUrl = txtAddressBar.Text
                            }
                        });
                    }
                }

                NotificationDialog.Information("Bright Sales", "Successfully updated LinkedIn url.");
            }
            catch(Exception ex)
            {
                NotificationDialog.Error("Bright Sales", "An error has been encountered while trying to save LinkedIn url.\nPlease consult system administrator.");
            }
        }
Beispiel #29
0
        private void tbxPassword_Leave(object sender, EventArgs e)
        {
            TextEdit _control = sender as TextEdit;
            if (gridViewUsers.RowCount < 1 || _control.Text.Length < 1)
                return;

            WaitDialog.Show("Saving data ...");
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                ObjectUser.UserInstance _item = gridViewUsers.GetFocusedRow() as ObjectUser.UserInstance;
                user _efoUser = _efDbContext.users.FirstOrDefault(i => i.id == _item.id);
                _efoUser.password = HashUtility.GetHashPassword(_control.Text);
                _efoUser.modified_by = UserSession.CurrentUser.UserId;
                _efoUser.modified_date = DateTime.Now;
                _efDbContext.users.ApplyCurrentValues(_efoUser);
                _efDbContext.SaveChanges();
                _efDbContext.Detach(_efoUser);
            }

            gridViewUsers.SetRowCellValue(gridViewUsers.FocusedRowHandle, "password", _control.Text);
            WaitDialog.Close();
        }
Beispiel #30
0
        public static bool SaveUserPassword(string pEmail, string pNewPassword, ref string pOldPassword)
        {
            var _Connection = UserSession.DefaultEntityConnection;
            if (_Connection == null)
                return false;

            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(_Connection)) {
                user _eftUser = _efDbContext.users.FirstOrDefault(i => i.email == pEmail && i.internal_user == true);
                if (_eftUser == null) {
                    BrightVision.Common.UI.NotificationDialog.Error("Error", "No match found for the user.\nPlease contact system administrator.");
                    return false;
                }

                if (Convert.ToBoolean(_eftUser.disabled)) {
                    _efDbContext.Detach(_eftUser);
                    return false;
                }

                if (_eftUser != null) {
                    _efDbContext.change_password_logs.AddObject(new change_password_logs() {
                        user_id = _eftUser.id,
                        old_password = _eftUser.password,
                        new_password = pNewPassword,
                        updated_by = _eftUser.id,
                        updated_on = DateTime.Now,
                        machine_name = UserSession.CurrentUser.ComputerName,
                        machine_ip = UserSession.CurrentUser.ComputerIP
                    });

                    pOldPassword = _eftUser.password;
                    _eftUser.password = HashUtility.GetHashPassword(pNewPassword);
                    _efDbContext.SaveChanges();
                    _efDbContext.Detach(_eftUser);
                }
                else
                    return false;
            }

            return true;
        }