Esempio n. 1
0
        public bool UpdateSetting(Common.UserEmailSetting userEmailSetting)
        {
            try
            {
                DataTable dataTable = base.FetchDataTable(@"SELECT COUNT(*) AS [Count] FROM [UserEmailSettings] WHERE [EmailAddress]=@EmailAddress AND
																																																							[UserGuid] = @UserGuid AND
																																																							[Guid]!=@Guid"                                                                                                                                                                                                                            , "@EmailAddress", userEmailSetting.EmailAddress,
                                                          "@UserGuid", userEmailSetting.UserGuid,
                                                          "@Guid", userEmailSetting.EmailSettingGuid);
                if (Helper.GetInt(dataTable.Rows[0]["Count"]) > 0)
                {
                    throw new Exception(Language.GetString("DuplicateEmail"));
                }
                else
                {
                    return(ExecuteSPCommand("UpdateSetting", "@Guid", userEmailSetting.EmailSettingGuid,
                                            "@EmailAddress", userEmailSetting.EmailAddress,
                                            "@Password", userEmailSetting.Password,
                                            "@Type", userEmailSetting.EmailHostType));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public Guid InsertSetting(Common.UserEmailSetting userEmailSetting)
        {
            try
            {
                DataTable dataTable = base.FetchDataTable(@"SELECT COUNT(*) AS [Count] FROM [UserEmailSettings] WHERE [EmailAddress]=@EmailAddress AND
																																																							[UserGuid] = @UserGuid"                                                                                                                                                                                                                            , "@EmailAddress", userEmailSetting.EmailAddress,
                                                          "@UserGuid", userEmailSetting.UserGuid);
                if (Helper.GetInt(dataTable.Rows[0]["Count"]) > 0)
                {
                    throw new Exception(Language.GetString("DuplicateEmail"));
                }
                else
                {
                    return(Insert(userEmailSetting));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }