public static void SetCRMSettings(CRMSettings settings) { RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE", true); if (rk.OpenSubKey("CM_CRM_Sync") == null) { rk.CreateSubKey("CM_CRM_Sync"); } else { rk.OpenSubKey("CM_CRM_Sync"); } rk.SetValue("CRMUserName", settings.UserName); rk.SetValue("CRMPassword", settings.Password); rk.SetValue("CRMDomain", settings.Domain); rk.SetValue("CRMUrl", settings.Url); if (!settings.ProtocolSSH) { rk.SetValue("CRMProtocol", "HTTP"); } else { rk.SetValue("CRMProtocol", "HTTPS"); } }
private void readRegistry() { CMSettings cmSettings = ConnectionSettingsManager.GetCMSettings(); CRMSettings crmSettings = ConnectionSettingsManager.GetCRMSettings(); int refreshRate = ServiceSettingsManager.GetRefreshRate(); if (cmSettings != null) { CMUserName.Text = cmSettings.UserName; CMPassword.Password = cmSettings.Password; CMApiKey.Text = cmSettings.ApiKey; } if (crmSettings != null) { CRMUserName.Text = crmSettings.UserName; CRMPassword.Password = crmSettings.Password; CRMDomain.Text = crmSettings.Domain; CRMUrl.Text = crmSettings.Url; if (crmSettings.ProtocolSSH) { CRMProtocol.SelectedIndex = 1; } else { CRMProtocol.SelectedIndex = 0; } } RefreshRate.Text = refreshRate.ToString(); }
private void readRegistry() { CMSettings cmSettings = ConnectionSettingsManager.GetCMSettings(); CRMSettings crmSettings = ConnectionSettingsManager.GetCRMSettings(); if (cmSettings != null) { CMUserName.Text = cmSettings.UserName; CMPassword.Password = cmSettings.Password; CMApiKey.Text = cmSettings.ApiKey; } if (crmSettings != null) { CRMUserName.Text = crmSettings.UserName; CRMPassword.Password = crmSettings.Password; CRMDomain.Text = crmSettings.Domain; CRMUrl.Text = crmSettings.Url; if (crmSettings.ProtocolSSH) { CRMProtocol.SelectedIndex = 1; } else { CRMProtocol.SelectedIndex = 0; } } //RegistryKey rk = Registry.CurrentUser.OpenSubKey("Software", true); //if (rk.OpenSubKey("CM_CRM_Sync") == null) //{ // rk.CreateSubKey("CM_CRM_Sync"); // rk.SetValue("CMUserName", "null"); // rk.SetValue("CMPassword", "null"); // rk.SetValue("CMApiKey", "null"); // rk.SetValue("CRMPassword", "null"); // rk.SetValue("CRMUserName", "null"); // rk.SetValue("CRMDomain", "null"); // rk.SetValue("CRMUrl", "null"); // rk.SetValue("CRMProtocol", "null"); //} //if (!rk.GetValue("CMUserName").ToString().Equals("null")) // CMUserName.Text = rk.GetValue("CMUserName").ToString(); //if (!rk.GetValue("CMPassword").ToString().Equals("null")) // CMPassword.Password = rk.GetValue("CMPassword").ToString(); //if (!rk.GetValue("CMApiKey").ToString().Equals("null")) // CMApiKey.Text = rk.GetValue("CMApiKey").ToString(); //if (!rk.GetValue("CRMPassword").ToString().Equals("null")) // CRMPassword.Password = rk.GetValue("CRMPassword").ToString(); //if (!rk.GetValue("CRMUserName").ToString().Equals("null")) // CRMUserName.Text = rk.GetValue("CRMUserName").ToString(); //if (!rk.GetValue("CRMDomain").ToString().Equals("null")) // CRMDomain.Text = rk.GetValue("CRMDomain").ToString(); //if (!rk.GetValue("CRMUrl").ToString().Equals("null")) // CRMUrl.Text = rk.GetValue("CRMUrl").ToString(); //if (rk.GetValue("CRMProtocol").ToString().Equals("HTTPS")) // CRMProtocol.SelectedIndex = 1; //else // CRMProtocol.SelectedIndex = 0; }
private void InitializeRepository() { cmSettings = ConnectionSettingsManager.GetCMSettings(); cmRepo = new CMRepository(cmSettings); crmSettings = ConnectionSettingsManager.GetCRMSettings(); crmRepo = new CRMRepository(crmSettings); }
public void UnsubscribeCRMSubscribersTest() { CRMSettings cmrSettings = new CRMSettings() { UserName = "******", Password = "******", Url = "https://internalcrm.virtua-it.si/TestiranjeCRM/", Domain = "it" }; List <Subscriber> importSubscribers = new List <Subscriber>() { new Subscriber() { E_mail = "*****@*****.**", Name = "Joze" }, new Subscriber() { E_mail = "*****@*****.**", Name = "Miha" }, new Subscriber() { E_mail = "*****@*****.**", Name = "Mojca" } }; CRMRepository repo = new CRMRepository(cmrSettings); repo.UnsubscribeSubscribers("328ec6c8-2f1e-e411-9419-005056a91611", importSubscribers); Assert.IsTrue(true); }
private void Save_Click(object sender, RoutedEventArgs e) { CMSettings cmSettings; CRMSettings crmSettings; cmSettings = new CMSettings() { UserName = CMUserName.Text, Password = CMPassword.Password, ApiKey = CMApiKey.Text }; bool protocilSsh; if (CRMProtocol.SelectedIndex == 0) { protocilSsh = false; } else { protocilSsh = true; } crmSettings = new CRMSettings() { UserName = CRMUserName.Text, Password = CRMPassword.Password, Domain = CRMDomain.Text, Url = CRMUrl.Text, ProtocolSSH = protocilSsh }; ConnectionSettingsManager.SetCMSettings(cmSettings); ConnectionSettingsManager.SetCRMSettings(crmSettings); //RegistryKey rk = Registry.CurrentUser.OpenSubKey("Software", true); //rk.OpenSubKey("CM_CRM_Sync"); //rk.SetValue("CMUserName", CMUserName.Text); //rk.SetValue("CMPassword", CMPassword.Password); //rk.SetValue("CMApiKey", CMApiKey.Text); //rk.SetValue("CRMUserName", CRMUserName.Text); //rk.SetValue("CRMPassword", CRMPassword.Password); //rk.SetValue("CRMDomain", CRMDomain.Text); //rk.SetValue("CRMUrl", CRMUrl.Text); //if (CRMProtocol.SelectedIndex == 0) // rk.SetValue("CRMProtocol", "HTTP"); //else // rk.SetValue("CRMProtocol", "HTTPS"); MessageBox.Show("Settings saved successfully"); SettingsWindow.Close(); }
public void CRMSubscribersTest() { CRMSettings cmrSettings = new CRMSettings() { UserName = "******", Password = "******", Url = "internalcrm.virtua-it.si/TestiranjeCRM/", Domain = "it", ProtocolSSH = true }; CRMRepository repo = new CRMRepository(cmrSettings); List <Sync.BL.Entities.Subscriber> marketnigLists = repo.GetSubscribers("328ec6c8-2f1e-e411-9419-005056a91611"); Assert.IsNotNull(marketnigLists); }
public void MarketingListTest() { CRMSettings cmrSettings = new CRMSettings() { UserName = "******", Password = "******", Url = "internalcrm.virtua-it.si/TestiranjeCRM/", Domain = "it", ProtocolSSH = true }; CRMRepository repo = new CRMRepository(cmrSettings); List <Sync.BL.Entities.List> marketnigLists = repo.GetMarketingLists(); Assert.IsNotNull(marketnigLists); }
private void TestCrm() { List <Sync.BL.Entities.List> crmList; bool protocilSsh; this.Dispatcher.Invoke((Action)(() => { if (CRMProtocol.SelectedIndex == 0) { protocilSsh = false; } else { protocilSsh = true; } crmSettings = new CRMSettings() { UserName = CRMUserName.Text, Password = CRMPassword.Password, Domain = CRMDomain.Text, Url = CRMUrl.Text, ProtocolSSH = protocilSsh }; })); try { crmRepo = new CRMRepository(crmSettings); crmList = crmRepo.GetMarketingLists(); this.Dispatcher.Invoke((Action)(() => { MessageBox.Show(Application.Current.MainWindow, "Connection is OK"); TestingScreen.Visibility = System.Windows.Visibility.Hidden; })); } catch { this.Dispatcher.Invoke((Action)(() => { MessageBox.Show(Application.Current.MainWindow, "Test failed!"); TestingScreen.Visibility = System.Windows.Visibility.Hidden; })); } }
//Read from register (instalation path, connection settings) private void Initialization() { cmSettings = ConnectionSettingsManager.GetCMSettings(); crmSettings = ConnectionSettingsManager.GetCRMSettings(); try { cmRepo = new CMRepository(cmSettings); crmRepo = new CRMRepository(crmSettings); } catch (Exception) { EventLogManager.WriteMessage(new Message() { Description = "Connection settings error", Type = "Error", Time = DateTime.Now }, EventType.Error); } }
private void Save_Click(object sender, RoutedEventArgs e) { CMSettings cmSettings; CRMSettings crmSettings; cmSettings = new CMSettings() { UserName = CMUserName.Text, Password = CMPassword.Password, ApiKey = CMApiKey.Text }; bool protocilSsh; if (CRMProtocol.SelectedIndex == 0) { protocilSsh = false; } else { protocilSsh = true; } crmSettings = new CRMSettings() { UserName = CRMUserName.Text, Password = CRMPassword.Password, Domain = CRMDomain.Text, Url = CRMUrl.Text, ProtocolSSH = protocilSsh }; ConnectionSettingsManager.SetCMSettings(cmSettings); ConnectionSettingsManager.SetCRMSettings(crmSettings); ServiceSettingsManager.SetRefreshRate(RefreshRate.Text); MessageBox.Show("Settings saved successfully"); this.Close(); }
public static void ConfigurePortal() { if (!Global.TenantSettings.IsConfiguredPortal) { using (var scope = DIHelper.Resolve()) { var daoFactory = scope.Resolve <DaoFactory>(); // Task Category var listItemDao = daoFactory.ListItemDao; listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_Call, "task_category_call.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_Deal, "task_category_deal.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_Demo, "task_category_demo.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_Email, "task_category_email.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_Fax, "task_category_fax.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_FollowUP, "task_category_follow_up.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_Lunch, "task_category_lunch.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_Meeting, "task_category_meeting.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_Note, "task_category_note.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_Ship, "task_category_ship.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_SocialNetworks, "task_category_social_networks.png")); listItemDao.CreateItem(ListType.TaskCategory, new ListItem(CRMTaskResource.TaskCategory_ThankYou, "task_category_thank_you.png")); // Deal Milestone New var milestoneDao = daoFactory.DealMilestoneDao; milestoneDao.Create(new DealMilestone { Title = CRMDealResource.DealMilestone_InitialContact_Title, Description = CRMDealResource.DealMilestone_InitialContact_Description, Probability = 1, Color = "#e795c1", Status = DealMilestoneStatus.Open }); milestoneDao.Create(new DealMilestone { Title = CRMDealResource.DealMilestone_Preapproach_Title, Description = CRMDealResource.DealMilestone_Preapproach_Description, Probability = 2, Color = "#df7895", Status = DealMilestoneStatus.Open }); milestoneDao.Create(new DealMilestone { Title = CRMDealResource.DealMilestone_Suspect_Title, Description = CRMDealResource.DealMilestone_Suspect_Description, Probability = 3, Color = "#f48454", SortOrder = 1, Status = DealMilestoneStatus.Open }); milestoneDao.Create(new DealMilestone { Title = CRMDealResource.DealMilestone_Champion_Title, Description = CRMDealResource.DealMilestone_Champion_Description, Probability = 20, Color = "#b58fd6", SortOrder = 2, Status = DealMilestoneStatus.Open }); milestoneDao.Create(new DealMilestone { Title = CRMDealResource.DealMilestone_Opportunity_Title, Description = CRMDealResource.DealMilestone_Opportunity_Description, Probability = 50, Color = "#d28cc8", SortOrder = 3, Status = DealMilestoneStatus.Open }); milestoneDao.Create(new DealMilestone { Title = CRMDealResource.DealMilestone_Prospect_Title, Description = CRMDealResource.DealMilestone_Prospect_Description, Probability = 75, Color = "#ffb45e", SortOrder = 4, Status = DealMilestoneStatus.Open }); milestoneDao.Create(new DealMilestone { Title = CRMDealResource.DealMilestone_Verbal_Title, Description = CRMDealResource.DealMilestone_Verbal_Description, Probability = 90, Color = "#ffd267", SortOrder = 5, Status = DealMilestoneStatus.Open }); milestoneDao.Create(new DealMilestone { Title = CRMDealResource.DealMilestone_Won_Title, Description = CRMDealResource.DealMilestone_Won_Description, Probability = 100, Color = "#6bbd72", SortOrder = 6, Status = DealMilestoneStatus.ClosedAndWon }); milestoneDao.Create(new DealMilestone { Title = CRMDealResource.DealMilestone_Lost_Title, Description = CRMDealResource.DealMilestone_Lost_Description, Probability = 0, Color = "#f2a9be", SortOrder = 7, Status = DealMilestoneStatus.ClosedAndLost }); // Contact Status listItemDao.CreateItem(ListType.ContactStatus, new ListItem { Title = CRMContactResource.ContactStatus_Cold, Color = "#8a98d8", SortOrder = 1 }); listItemDao.CreateItem(ListType.ContactStatus, new ListItem { Title = CRMContactResource.ContactStatus_Warm, Color = "#ffd267", SortOrder = 2 }); listItemDao.CreateItem(ListType.ContactStatus, new ListItem { Title = CRMContactResource.ContactStatus_Hot, Color = "#df7895", SortOrder = 3 }); // Contact Type listItemDao.CreateItem(ListType.ContactType, new ListItem { Title = CRMContactResource.ContactType_Client, SortOrder = 1 }); listItemDao.CreateItem(ListType.ContactType, new ListItem { Title = CRMContactResource.ContactType_Supplier, SortOrder = 2 }); listItemDao.CreateItem(ListType.ContactType, new ListItem { Title = CRMContactResource.ContactType_Partner, SortOrder = 3 }); listItemDao.CreateItem(ListType.ContactType, new ListItem { Title = CRMContactResource.ContactType_Competitor, SortOrder = 4 }); // History Category listItemDao.CreateItem(ListType.HistoryCategory, new ListItem(CRMCommonResource.HistoryCategory_Note, "event_category_note.png")); listItemDao.CreateItem(ListType.HistoryCategory, new ListItem(CRMCommonResource.HistoryCategory_Email, "event_category_email.png")); listItemDao.CreateItem(ListType.HistoryCategory, new ListItem(CRMCommonResource.HistoryCategory_Call, "event_category_call.png")); listItemDao.CreateItem(ListType.HistoryCategory, new ListItem(CRMCommonResource.HistoryCategory_Meeting, "event_category_meeting.png")); // Tags daoFactory.TagDao.AddTag(EntityType.Contact, CRMContactResource.Lead, true); daoFactory.TagDao.AddTag(EntityType.Contact, CRMContactResource.Customer, true); daoFactory.TagDao.AddTag(EntityType.Contact, CRMContactResource.Supplier, true); daoFactory.TagDao.AddTag(EntityType.Contact, CRMContactResource.Staff, true); var tenantSettings = Global.TenantSettings; tenantSettings.WebFormKey = Guid.NewGuid(); tenantSettings.IsConfiguredPortal = true; tenantSettings.Save(); } } if (!Global.TenantSettings.IsConfiguredSmtp) { var smtp = CRMSettings.Load().SMTPServerSettingOld; if (smtp != null && CoreContext.Configuration.SmtpSettings.IsDefaultSettings) { try { var newSettings = new SmtpSettings(smtp.Host, smtp.Port, smtp.SenderEmailAddress, smtp.SenderDisplayName) { EnableSSL = smtp.EnableSSL, EnableAuth = smtp.RequiredHostAuthentication, }; if (!string.IsNullOrEmpty(smtp.HostLogin) && !string.IsNullOrEmpty(smtp.HostPassword)) { newSettings.SetCredentials(smtp.HostLogin, smtp.HostPassword); } CoreContext.Configuration.SmtpSettings = newSettings; } catch (Exception e) { LogManager.GetLogger("ASC").Error("ConfigurePortal", e); } } var tenantSettings = Global.TenantSettings; tenantSettings.IsConfiguredSmtp = true; tenantSettings.Save(); } }