Esempio n. 1
0
        public object SaveSettings(bool smsEnable)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                if (smsEnable && StudioSmsNotificationSettings.SentSms >= StudioSmsNotificationSettings.PaidSms)
                {
                    throw new Exception(Resource.SmsNotPaidError);
                }

                StudioSmsNotificationSettings.Enable = smsEnable;

                AdminLog.PostAction("Settings: saved sms validation settings to {0}", smsEnable);

                return(new
                {
                    Status = 1,
                    Message = Resource.SuccessfullySaveSettingsMessage
                });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
Esempio n. 2
0
        public object SaveCustomNamingSettings(string usrCaption, string usrsCaption, string grpCaption, string grpsCaption,
                                               string usrStatusCaption, string regDateCaption,
                                               string grpHeadCaption,
                                               string guestCaption, string guestsCaption)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                usrCaption       = (usrCaption ?? "").Trim();
                usrsCaption      = (usrsCaption ?? "").Trim();
                grpCaption       = (grpCaption ?? "").Trim();
                grpsCaption      = (grpsCaption ?? "").Trim();
                usrStatusCaption = (usrStatusCaption ?? "").Trim();
                regDateCaption   = (regDateCaption ?? "").Trim();
                grpHeadCaption   = (grpHeadCaption ?? "").Trim();
                guestCaption     = (guestCaption ?? "").Trim();
                guestsCaption    = (guestsCaption ?? "").Trim();

                if (String.IsNullOrEmpty(usrCaption) ||
                    String.IsNullOrEmpty(usrsCaption) ||
                    String.IsNullOrEmpty(grpCaption) ||
                    String.IsNullOrEmpty(grpsCaption) ||
                    String.IsNullOrEmpty(usrStatusCaption) ||
                    String.IsNullOrEmpty(regDateCaption) ||
                    String.IsNullOrEmpty(grpHeadCaption) ||
                    String.IsNullOrEmpty(guestCaption) ||
                    String.IsNullOrEmpty(guestsCaption))
                {
                    throw new Exception(Resource.ErrorEmptyFields);
                }

                var names = new PeopleNamesItem
                {
                    Id               = PeopleNamesItem.CustomID,
                    UserCaption      = usrCaption.Substring(0, Math.Min(30, usrCaption.Length)),
                    UsersCaption     = usrsCaption.Substring(0, Math.Min(30, usrsCaption.Length)),
                    GroupCaption     = grpCaption.Substring(0, Math.Min(30, grpCaption.Length)),
                    GroupsCaption    = grpsCaption.Substring(0, Math.Min(30, grpsCaption.Length)),
                    UserPostCaption  = usrStatusCaption.Substring(0, Math.Min(30, usrStatusCaption.Length)),
                    RegDateCaption   = regDateCaption.Substring(0, Math.Min(30, regDateCaption.Length)),
                    GroupHeadCaption = grpHeadCaption.Substring(0, Math.Min(30, grpHeadCaption.Length)),
                    GuestCaption     = guestCaption.Substring(0, Math.Min(30, guestCaption.Length)),
                    GuestsCaption    = guestsCaption.Substring(0, Math.Min(30, guestsCaption.Length)),
                };

                CustomNamingPeople.SetPeopleNames(names);

                CoreContext.TenantManager.SaveTenant(CoreContext.TenantManager.GetCurrentTenant());

                AdminLog.PostAction("Settings: saved team template settings to {0:Json}", names);
                MessageService.Send(HttpContext.Current.Request, MessageAction.TeamTemplateChanged);

                return(new { Status = 1, Message = Resource.SuccessfullySaveSettingsMessage });
            }
            catch (Exception e)
            {
                return(new { Status = 0, e.Message });
            }
        }
        public object ChangeOwner(Guid ownerId)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                var curTenant = CoreContext.TenantManager.GetCurrentTenant();
                var owner     = CoreContext.UserManager.GetUsers(curTenant.OwnerId);

                if (owner.IsVisitor())
                {
                    throw new System.Security.SecurityException("Collaborator can not be an owner");
                }

                if (curTenant.OwnerId.Equals(SecurityContext.CurrentAccount.ID) && !Guid.Empty.Equals(ownerId))
                {
                    StudioNotifyService.Instance.SendMsgConfirmChangeOwner(curTenant,
                                                                           CoreContext.UserManager.GetUsers(ownerId).DisplayUserName(),
                                                                           GetConfirmLink(ownerId, owner.Email));

                    var emailLink = string.Format("<a href=\"mailto:{0}\">{0}</a>", owner.Email);
                    return(new { Status = 1, Message = Resource.ChangePortalOwnerMsg.Replace(":email", emailLink) });
                }

                AdminLog.PostAction("Settings: changed portal owner to ID=\"{0}\"", ownerId);

                return(new { Status = 0, Message = Resource.ErrorAccessDenied });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
Esempio n. 4
0
        public object SaveSettings(bool turnOn)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                var passwordSettingsObj = new StudioAdminMessageSettings {
                    Enable = turnOn
                };
                SettingsManager.Instance.SaveSettings(passwordSettingsObj, TenantProvider.CurrentTenantID);

                AdminLog.PostAction("Settings: saved admin message settings to \"{0}\"", turnOn);
                MessageService.Send(HttpContext.Current.Request, MessageAction.AdministratorMessageSettingsUpdated);

                return(new
                {
                    Status = 1,
                    Message = Resources.Resource.SuccessfullySaveSettingsMessage
                });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
        public virtual int Create(DealMilestone item)
        {
            if (String.IsNullOrEmpty(item.Title) || String.IsNullOrEmpty(item.Color))
            {
                throw new ArgumentException();
            }

            int id;

            using (var db = GetDb())
                using (var tx = db.BeginTransaction())
                {
                    if (item.SortOrder == 0)
                    {
                        item.SortOrder = db.ExecuteScalar <int>(Query("crm_deal_milestone")
                                                                .SelectMax("sort_order")) + 1;
                    }

                    id = db.ExecuteScalar <int>(
                        Insert("crm_deal_milestone")
                        .InColumnValue("id", 0)
                        .InColumnValue("title", item.Title)
                        .InColumnValue("description", item.Description)
                        .InColumnValue("color", item.Color)
                        .InColumnValue("probability", item.Probability)
                        .InColumnValue("status", (int)item.Status)
                        .InColumnValue("sort_order", item.SortOrder)
                        .Identity(1, 0, true));
                    tx.Commit();
                }

            AdminLog.PostAction("CRM: saved opportunity stage {0}", item);

            return(id);
        }
        public object SaveSettings(bool smsEnable)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                if (!StudioSmsNotificationSettings.IsVisibleSettings || CoreContext.PaymentManager.GetApprovedPartner() != null)
                {
                    throw new Exception(Resource.SmsNotAvailable);
                }

                if (smsEnable && StudioSmsNotificationSettings.LeftSms <= 0)
                {
                    throw new Exception(Resource.SmsNotPaidError);
                }

                StudioSmsNotificationSettings.Enable = smsEnable;

                AdminLog.PostAction("Settings: saved sms validation settings to {0}", smsEnable);

                MessageService.Send(HttpContext.Current.Request, MessageAction.TwoFactorAuthenticationSettingsUpdated);

                return(new
                {
                    Status = 1,
                    Message = Resource.SuccessfullySaveSettingsMessage
                });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
        public object AddAdmin(Guid id)
        {
            SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

            var user = CoreContext.UserManager.GetUsers(id);

            if (user.IsVisitor())
            {
                throw new System.Security.SecurityException("Collaborator can not be an administrator");
            }

            WebItemSecurity.SetProductAdministrator(Guid.Empty, id, true);

            var result = new
            {
                id           = user.ID,
                smallFotoUrl = user.GetSmallPhotoURL(),
                displayName  = user.DisplayUserName(),
                title        = user.Title.HtmlEncode(),
                userUrl      = CommonLinkUtility.GetUserProfile(user.ID),
                accessList   = GetAccessList(user.ID)
            };

            AdminLog.PostAction("Settings: added portal administrator ID=\"{0}\"", id);

            return(result);
        }
        public object SavePasswordSettings(string objData)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                var jsSerializer        = new System.Web.Script.Serialization.JavaScriptSerializer();
                var passwordSettingsObj = jsSerializer.Deserialize <StudioPasswordSettings>(objData);
                SettingsManager.Instance.SaveSettings(passwordSettingsObj, TenantProvider.CurrentTenantID);

                AdminLog.PostAction("Settings: saved password strength settings to {0}", objData);

                MessageService.Send(HttpContext.Current.Request, MessageAction.PasswordStrengthSettingsUpdated);

                return(new
                {
                    Status = 1,
                    Message = Resources.Resource.SuccessfullySaveSettingsMessage
                });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
Esempio n. 9
0
        public object SaveSettings(string defaultProductID)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                var defaultPageSettingsObj = new StudioDefaultPageSettings
                {
                    DefaultProductID = new Guid(defaultProductID)
                };
                var resultStatus = SettingsManager.Instance.SaveSettings(defaultPageSettingsObj, TenantProvider.CurrentTenantID);

                AdminLog.PostAction("Settings: default product ID \"{0}\"", defaultProductID);

                return(new
                {
                    Status = 1,
                    Message = Resources.Resource.SuccessfullySaveSettingsMessage
                });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
Esempio n. 10
0
        public string SendNotificationToChange(string userId)
        {
            var user = CoreContext.UserManager.GetUsers(
                string.IsNullOrEmpty(userId)
                    ? SecurityContext.CurrentAccount.ID
                    : new Guid(userId));

            var canChange =
                user.IsMe() ||
                SecurityContext.CheckPermissions(new UserSecurityProvider(user.ID), ASC.Core.Users.Constants.Action_EditUser);

            if (!canChange)
            {
                throw new SecurityAccessDeniedException(Resource.ErrorAccessDenied);
            }

            user.MobilePhoneActivationStatus = MobilePhoneActivationStatus.NotActivated;
            CoreContext.UserManager.SaveUserInfo(user);

            if (user.IsMe())
            {
                return(StudioNotifyService.GenerateConfirmUrl(user.Email, ConfirmType.PhoneActivation));
            }

            AdminLog.PostAction("UserProfile: erase phone number for user with id {0}", user.ID);
            StudioNotifyService.Instance.SendMsgMobilePhoneChange(user);
            return(string.Empty);
        }
Esempio n. 11
0
        public object RestoreGreetingSettings()
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                _tenantInfoSettings = SettingsManager.Instance.LoadSettings <TenantInfoSettings>(TenantProvider.CurrentTenantID);
                _tenantInfoSettings.RestoreDefault();
                SettingsManager.Instance.SaveSettings <TenantInfoSettings>(_tenantInfoSettings, TenantProvider.CurrentTenantID);

                AdminLog.PostAction("Settings: restored previous greeting settings");

                return(new
                {
                    Status = 1,
                    Message = Resources.Resource.SuccessfullySaveGreetingSettingsMessage,
                    LogoPath = _tenantInfoSettings.GetAbsoluteCompanyLogoPath(),
                    CompanyName = CoreContext.TenantManager.GetCurrentTenant().Name,
                });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
Esempio n. 12
0
        public void WriteTextTest()
        {
            AdminLog.PostAction("test {0} {1:Json}!", 4, Tuple.Create(5, "dddd"));

            CoreContext.TenantManager.SetCurrentTenant(0);
            SecurityContext.AuthenticateMe("*****@*****.**", "111111");
            AdminLog.PostAction("test2!");
        }
Esempio n. 13
0
        public virtual int CreateItem(ListType listType, ListItem enumItem)
        {
            if (IsExist(listType, enumItem.Title))
            {
                return(GetByTitle(listType, enumItem.Title).ID);
            }

            if (String.IsNullOrEmpty(enumItem.Title))
            {
                throw new ArgumentException();
            }

            if (listType == ListType.TaskCategory || listType == ListType.HistoryCategory)
            {
                if (String.IsNullOrEmpty(enumItem.AdditionalParams))
                {
                    throw new ArgumentException();
                }
                else
                {
                    enumItem.AdditionalParams = System.IO.Path.GetFileName(enumItem.AdditionalParams);
                }
            }

            if (listType == ListType.ContactStatus)
            {
                if (String.IsNullOrEmpty(enumItem.Color))
                {
                    throw new ArgumentException();
                }
            }

            var sortOrder = enumItem.SortOrder;

            using (var db = GetDb())
            {
                if (sortOrder == 0)
                {
                    sortOrder = db.ExecuteScalar <int>(Query("crm_list_item")
                                                       .Where(Exp.Eq("list_type", (int)listType))
                                                       .SelectMax("sort_order")) + 1;
                }

                AdminLog.PostAction("CRM: saved crm category of type \"{0}\" with parameters {1:Json}", listType, enumItem);

                return(db.ExecuteScalar <int>(
                           Insert("crm_list_item")
                           .InColumnValue("id", 0)
                           .InColumnValue("list_type", (int)listType)
                           .InColumnValue("description", enumItem.Description)
                           .InColumnValue("title", enumItem.Title)
                           .InColumnValue("additional_params", enumItem.AdditionalParams)
                           .InColumnValue("color", enumItem.Color)
                           .InColumnValue("sort_order", sortOrder)
                           .Identity(1, 0, true)));
            }
        }
Esempio n. 14
0
        public IProgressItem SendEmail(List <int> fileIDs, List <int> contactIds, String subjectTemplate, String bodyTemplate, bool storeInHistory)
        {
            var joinFileIDs    = string.Join("|", fileIDs.ConvertAll(x => x.ToString(CultureInfo.InvariantCulture)).ToArray());
            var joinContactIDs = string.Join("|", contactIds.ConvertAll(x => x.ToString(CultureInfo.InvariantCulture)).ToArray());

            AdminLog.PostAction("CRM: started email sending with parameters subjectTemlate={0},bodyTemplate={1},contactIDs={2},fileIDs={3}", subjectTemplate, bodyTemplate, joinContactIDs, joinFileIDs);

            return(MailSender.Start(fileIDs, contactIds, subjectTemplate, bodyTemplate, storeInHistory));
        }
        public void StartImport(EntityType entityType, String CSVFileURI, String importSettingsJSON)
        {
            ImportFromCSV.Start(entityType, CSVFileURI, importSettingsJSON);
            AdminLog.PostAction("CRM: started import operation of type \"{0}\" with settings {1}>", entityType, importSettingsJSON);

            var action = GetMessageAction(entityType);

            MessageService.Send(HttpContext.Current.Request, action);
        }
Esempio n. 16
0
        public IProgressItem Cancel()
        {
            var progressItem = GetStatus();

            MailSender.Cancel();

            AdminLog.PostAction("CRM: canceled mail sending");

            return(progressItem);
        }
Esempio n. 17
0
 public virtual void Delete(int id)
 {
     if (!HaveContactLink(id))
     {
         using (var db = GetDb())
         {
             db.ExecuteNonQuery(Delete("crm_deal_milestone").Where(Exp.Eq("id", id)));
         }
         AdminLog.PostAction("CRM: deleted opportunity stage having id {0}", id);
     }
 }
        public IProgressItem StartExportData()
        {
            if (!CRMSecurity.IsAdmin)
            {
                throw new Exception();
            }

            AdminLog.PostAction("CRM Settings: started crm data export");

            return(ExportToCSV.Start());
        }
Esempio n. 19
0
        public InvoiceSetting SaveInvoiceSettings(InvoiceSetting invoiceSetting)
        {
            var tenantSettings = Global.TenantSettings;

            tenantSettings.InvoiceSetting = invoiceSetting;

            SettingsManager.Instance.SaveSettings(tenantSettings, TenantProvider.CurrentTenantID);

            AdminLog.PostAction("CRM Settings: saved crm invoice settings to \"{0:Json}\"", tenantSettings.InvoiceSetting);

            return(tenantSettings.InvoiceSetting);
        }
Esempio n. 20
0
        public IProgressItem StartExportData()
        {
            if (!CRMSecurity.IsAdmin)
            {
                throw new Exception();
            }

            AdminLog.PostAction("CRM Settings: started crm data export");
            MessageService.Send(HttpContext.Current.Request, MessageAction.CrmAllDataExported);

            return(ExportToCSV.Start());
        }
Esempio n. 21
0
        public virtual void DeleteItem(ListType listType, int itemID)
        {
            if (HaveRelativeItemsLink(listType, itemID))
            {
                throw new ArgumentException();
            }

            using (var db = GetDb())
            {
                db.ExecuteNonQuery(Delete("crm_list_item").Where(Exp.Eq("id", itemID) & Exp.Eq("list_type", (int)listType)));
            }

            AdminLog.PostAction("CRM: deleted crm category of type \"{0}\" having ID \"{1}\"", listType, itemID);
        }
Esempio n. 22
0
        public object SaveMailDomainSettings(TenantTrustedDomainsType type, List <string> domains, bool inviteUsersAsVisitors)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                var tenant = CoreContext.TenantManager.GetCurrentTenant();

                if (type == TenantTrustedDomainsType.Custom)
                {
                    tenant.TrustedDomains.Clear();
                    foreach (var domain in domains)
                    {
                        var d = (domain ?? "").Trim().ToLower();
                        if (!CheckTrustedDomain(d))
                        {
                            return new { Status = 0, Message = Resources.Resource.ErrorNotCorrectTrustedDomain }
                        }
                        ;

                        tenant.TrustedDomains.Add(d);
                    }
                }

                if (tenant.TrustedDomains.Count == 0)
                {
                    tenant.TrustedDomainsType = TenantTrustedDomainsType.None;
                }
                else
                {
                    tenant.TrustedDomainsType = type;
                }

                var domainSettingsObj = new StudioTrustedDomainSettings {
                    InviteUsersAsVisitors = inviteUsersAsVisitors
                };
                var resultStatus = SettingsManager.Instance.SaveSettings(domainSettingsObj, TenantProvider.CurrentTenantID);

                CoreContext.TenantManager.SaveTenant(tenant);

                AdminLog.PostAction("Settings: saved mail domain settings with parameters type={0}, domains={1}, inviteUsersAsVisitors={2}", type, string.Join("|", domains.ToArray()), inviteUsersAsVisitors.ToString());

                return(new { Status = 1, Message = Resources.Resource.SuccessfullySaveSettingsMessage });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
        public void SaveChangeSettings(String defaultCurrency)
        {
            if (!CRMSecurity.IsAdmin)
            {
                throw new Exception();
            }

            var tenantSettings = Global.TenantSettings;

            tenantSettings.DefaultCurrency = CurrencyProvider.Get(defaultCurrency);

            SettingsManager.Instance.SaveSettings(tenantSettings, TenantProvider.CurrentTenantID);

            AdminLog.PostAction("CRM Settings: saved default currency settings to \"{0:Json}\"", defaultCurrency);
        }
        public object SaveLanguageTimeSettings(string lng, string timeZoneID)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                var tenant  = CoreContext.TenantManager.GetCurrentTenant();
                var culture = CultureInfo.GetCultureInfo(lng);

                var changelng = false;
                if (SetupInfo.EnabledCultures.Find(c => String.Equals(c.Name, culture.Name, StringComparison.InvariantCultureIgnoreCase)) != null)
                {
                    if (!String.Equals(tenant.Language, culture.Name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        tenant.Language = culture.Name;
                        changelng       = true;
                    }
                }

                var oldTimeZone = tenant.TimeZone;
                tenant.TimeZone = new List <TimeZoneInfo>(TimeZoneInfo.GetSystemTimeZones()).Find(tz => String.Equals(tz.Id, timeZoneID));

                CoreContext.TenantManager.SaveTenant(tenant);

                if (!tenant.TimeZone.Id.Equals(oldTimeZone.Id) || changelng)
                {
                    AdminLog.PostAction("Settings: saved language and time zone settings with parameters language={0},time={1}", lng, timeZoneID);

                    if (!tenant.TimeZone.Id.Equals(oldTimeZone.Id))
                    {
                        MessageService.Send(HttpContext.Current.Request, MessageAction.TimeZoneSettingsUpdated);
                    }

                    if (changelng)
                    {
                        MessageService.Send(HttpContext.Current.Request, MessageAction.LanguageSettingsUpdated);
                    }
                }

                return(changelng
                           ? new { Status = 1, Message = String.Empty }
                           : new { Status = 2, Message = Resource.SuccessfullySaveSettingsMessage });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message.HtmlEncode() });
            }
        }
Esempio n. 25
0
        public object SaveNamingSettings(string schemaId)
        {
            try
            {
                SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

                CustomNamingPeople.SetPeopleNames(schemaId);

                AdminLog.PostAction("Settings: saved team template settings to schema={0}", schemaId);

                return(new { Status = 1, Message = Resources.Resource.SuccessfullySaveSettingsMessage });
            }
            catch (Exception e)
            {
                return(new { Status = 0, Message = e.Message });
            }
        }
Esempio n. 26
0
        public string Delete(bool flag)
        {
            SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

            var t = CoreContext.TenantManager.GetCurrentTenant();

            if (t != null)
            {
                SendMailDelete(t);
                var u         = CoreContext.UserManager.GetUsers(t.OwnerId);
                var emailLink = string.Format("<a href=\"mailto:{0}\">{0}</a>", u.Email);

                AdminLog.PostAction("Settings: deleted portal");

                return(((string)Resources.Resource.AccountDeletionMsg).Replace(":email", emailLink));
            }
            return(string.Empty);
        }
Esempio n. 27
0
 public Tenant SetTenantVersion(Tenant tenant, int version)
 {
     if (tenant == null)
     {
         throw new ArgumentNullException("tenant");
     }
     if (tenant.Version != version)
     {
         tenant.Version = version;
         SaveTenant(tenant);
         AdminLog.PostAction("Settings: switched portal version settings to <{0}>", version);
     }
     else
     {
         throw new ArgumentException("This is current version already");
     }
     return(tenant);
 }
Esempio n. 28
0
        public virtual void EditItem(ListType listType, ListItem enumItem)
        {
            if (HaveRelativeItemsLink(listType, enumItem.ID))
            {
                throw new ArgumentException();
            }

            using (var db = GetDb())
            {
                db.ExecuteNonQuery(Update("crm_list_item")
                                   .Set("description", enumItem.Description)
                                   .Set("title", enumItem.Title)
                                   .Set("additional_params", enumItem.AdditionalParams)
                                   .Set("color", enumItem.Color)
                                   .Where(Exp.Eq("id", enumItem.ID)));
            }

            AdminLog.PostAction("CRM: saved crm category of type \"{0}\" with parameters {1:Json}", listType, enumItem);
        }
        public void SaveSMTPSettings(string host, int port, bool authentication, string hostLogin, string hostPassword, string senderDisplayName, string senderEmailAddress, bool enableSSL)
        {
            var crmSettings = Global.TenantSettings;

            crmSettings.SMTPServerSetting = new SMTPServerSetting
            {
                Host = host,
                Port = port,
                RequiredHostAuthentication = authentication,
                HostLogin          = hostLogin,
                HostPassword       = hostPassword,
                SenderDisplayName  = senderDisplayName,
                SenderEmailAddress = senderEmailAddress,
                EnableSSL          = enableSSL
            };

            SettingsManager.Instance.SaveSettings(crmSettings, TenantProvider.CurrentTenantID);

            AdminLog.PostAction("CRM Settings: saved crm smtp settings to {0}", crmSettings);
        }
Esempio n. 30
0
        public virtual void Edit(DealMilestone item)
        {
            if (HaveContactLink(item.ID))
            {
                throw new ArgumentException();
            }

            using (var db = GetDb())
            {
                db.ExecuteNonQuery(Update("crm_deal_milestone")
                                   .Set("title", item.Title)
                                   .Set("description", item.Description)
                                   .Set("color", item.Color)
                                   .Set("probability", item.Probability)
                                   .Set("status", (int)item.Status)
                                   .Where(Exp.Eq("id", item.ID)));
            }

            AdminLog.PostAction("CRM: saved opportunity stage {0:Json}", item);
        }