Exemplo n.º 1
0
 public bool InsertGroupTemplate(Common.GroupTemplate groupTemplate)
 {
     try
     {
         DataTable dataTableGroupTemplate = base.FetchDataTable("SELECT COUNT(*) AS [Count] FROM [GroupTemplates] WHERE [Title] = @Title AND [UserGuid] = @UserGuid", "@Title", groupTemplate.Title, "@UserGuid", groupTemplate.UserGuid);
         if (Helper.GetInt(dataTableGroupTemplate.Rows[0]["Count"]) == 0)
         {
             return(base.Insert(groupTemplate) != Guid.Empty ? true : false);
         }
         else
         {
             throw new Exception(Language.GetString("DuplicateTitleGroupTemplate"));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
        public bool UpdateGroupTemplate(Common.GroupTemplate groupTemplate)
        {
            try
            {
                DataTable dataTableGroupTemplate = base.FetchDataTable(@"SELECT COUNT(*) AS [Count] FROM [GroupTemplates]
																																 WHERE [Title] = @Title AND [Guid] != @Guid AND [UserGuid] = @UserGuid"                                                                                                                                , "@Title", groupTemplate.Title, "@Guid", groupTemplate.GroupTemplateGuid, "@UserGuid", groupTemplate.UserGuid);
                if (Helper.GetInt(dataTableGroupTemplate.Rows[0]["Count"]) == 0)
                {
                    return(base.ExecuteSPCommand("UpdateGroupTemplate", "Guid", groupTemplate.GroupTemplateGuid,
                                                 "Title", groupTemplate.Title));
                }
                else
                {
                    throw new Exception(Language.GetString("DuplicateTitleGroupTemplate"));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }