public async Task <bool> setThemeForUser(AppUserTheme appUserTheme)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format(@"
              BEGIN 
              IF NOT EXISTS (SELECT USID FROM APPUSERADDONCONFIG WHERE USID=@ID)
              BEGIN
              INSERT INTO APPUSERADDONCONFIG (USID,THEME,SKIN) VALUES (@ID,@THEME,@SKIN);
              END
              ELSE
              BEGIN
              UPDATE APPUSERADDONCONFIG SET THEME=@THEME,SKIN=@SKIN WHERE USID=@ID
              END
              END
         ", tableName));
         command.Parameters.AddWithValue("@ID", appUserTheme.USID);
         command.Parameters.AddWithValue("@THEME", appUserTheme.THEME);
         command.Parameters.AddWithValue("@SKIN", appUserTheme.SKIN);
         DBServer.ExecuteNon(command);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public bool save(ref AppNotification data)
 {
     try
     {
         SqlCommand command;
         if (data == null)
         {
             throw new Exception("Null notification not allowed.");
         }
         if (String.IsNullOrEmpty(data.ntype))
         {
             data.ntype = "user";
         }
         if (data.userId == 0)
         {
         }
         data.updatedDate = DateTime.Now;
         if (data.id == 0)
         {
             data.createdDate = DateTime.Now;
             command          = data.InsertInto();
             data.id          = DBServer.ExecuteNScalar(command);
         }
         else
         {
             command = data.UpdateInto();
             DBServer.ExecuteNon(command);
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 3
0
 public bool delete(int id)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format("UPDATE {0} SET ISDELETED=1 WHERE ID=@ID", tableName));
         command.Parameters.AddWithValue("@ID", id);
         DBServer.ExecuteNon(command);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
 public bool save(Products data)
 {
     try
     {
         SqlCommand command;
         if (data.id == 0)
         {
             command = data.InsertInto();
         }
         else
         {
             command = data.UpdateInto();
         }
         DBServer.ExecuteNon(command);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }