public List <AppPermission> getAllDefaultPermissions()
 {
     try
     {
         SqlCommand command        = new SqlCommand("SELECT s.Mode,s.ALIAS,s.VALUE, 0 [ID],-1 [APPUSERID],s.ID [APPSETTINGID],4 [PERMISSION] FROM AppSettings s");
         DataTable  permissionData = DBServer.ExecuteDataTable(command);
         if (permissionData.Rows.Count == 0)
         {
             return(null);
         }
         return(permissionData.ConvertList <AppPermission>());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
 public Products getById(int id)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format("SELECT * FROM {0} WHERE ID=@ID AND ISDELETED=0", tableName));
         command.Parameters.AddWithValue("@ID", id);
         DataTable productData = DBServer.ExecuteDataTable(command);
         if (productData.Rows.Count == 0)
         {
             return(null);
         }
         return(productData.Rows[0].Convert <Products>());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public string getName(int id)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format("SELECT * FROM {0} WHERE ID=@ID", tableName));
         command.Parameters.AddWithValue("@ID", id);
         DataTable productData = DBServer.ExecuteDataTable(command);
         if (productData.Rows.Count == 0)
         {
             return("");
         }
         return(productData.Rows[0]["NAME"].ToString());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
 public AppUserInfo getUserSettingsById(int id)
 {
     try
     {
         SqlCommand command = new SqlCommand("SELECT * FROM USERSETTINGS WHERE ID=@ID");
         command.Parameters.AddWithValue("@ID", id);
         DataTable userData = DBServer.ExecuteDataTable(command);
         if (userData.Rows.Count == 0)
         {
             return(null);
         }
         return(userData.Rows[0].Convert <AppUserInfo>());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public AppNotification getById(int id)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format("SELECT * FROM {0} WHERE ID=@ID", tableName));
         command.Parameters.AddWithValue("@ID", id);
         DataTable notificationData = DBServer.ExecuteDataTable(command);
         if (notificationData.Rows.Count == 0)
         {
             return(null);
         }
         return(notificationData.Rows[0].Convert <AppNotification>());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 6
0
 public AppUserInfo getUserInfoByUserId(int id)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format("SELECT A.*,B.DisplayName,B.USERNAME AS EMAIL FROM APPUSERINFO A LEFT JOIN {0} B ON A.USID=B.ID WHERE A.USID=@ID", tableName));
         command.Parameters.AddWithValue("@ID", id);
         DataTable userData = DBServer.ExecuteDataTable(command);
         if (userData.Rows.Count == 0)
         {
             return(null);
         }
         return(userData.Rows[0].Convert <AppUserInfo>());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 7
0
 public AppUserAddOnConfig getConfigById(int id)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format("SELECT * FROM {0} WHERE ID=@ID", configTableName));
         command.Parameters.AddWithValue("@ID", id);
         DataTable userData = DBServer.ExecuteDataTable(command);
         if (userData.Rows.Count == 0)
         {
             return(null);
         }
         return(userData.Rows[0].Convert <AppUserAddOnConfig>());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 8
0
 public AppUser getByUserName(string username)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format("SELECT * FROM {0} WHERE USERNAME=@USERNAME AND ISDELETED=0", tableName));
         command.Parameters.AddWithValue("@USERNAME", username);
         DataTable userData = DBServer.ExecuteDataTable(command);
         if (userData.Rows.Count == 0)
         {
             return(null);
         }
         return(userData.Rows[0].Convert <AppUser>());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public ProductCategory[] getByCategoryId(int id)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format("SELECT * FROM {0} WHERE CATEGORYID=@ID AND ISDELETED=0", tableName));
         command.Parameters.AddWithValue("@ID", id);
         DataTable categoryData = DBServer.ExecuteDataTable(command);
         if (categoryData.Rows.Count == 0)
         {
             return(null);
         }
         return(categoryData.ConvertToArray <ProductCategory>());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 10
0
 public AppUser SaveProfileImage(UserProfileImage Image)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format("UPDATE {0} SET PROFILEIMG=@Image WHERE ID =@ID; SELECT * FROM APPUSER WHERE ID=@ID", tableName));
         command.Parameters.AddWithValue("@ID", Image.ID);
         command.Parameters.AddWithValue("@Image", Image.PROFILEIMG);
         DataTable userData = DBServer.ExecuteDataTable(command);
         if (userData.Rows.Count == 0)
         {
             return(null);
         }
         return(userData.Rows[0].Convert <AppUser>());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 11
0
 public List <AppPermission> getByUserId(int id, bool active = false)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format(@"SELECT s.Mode,s.ALIAS,s.VALUE, ISNULL(p.ID,0) ID,
                 ISNULL(p.APPUSERID,@ID) APPUSERID, ISNULL(p.APPSETTINGID,s.ID) APPSETTINGID,
                 ISNULL(p.PERMISSION,0) PERMISSION
                 FROM AppSettings s left join {0} p on s.id=p.appsettingid and p.APPUSERID=@ID WHERE s.TYPE='M' {1}", tableName, (active ? " p.PERMISSION=1 " : "")));
         command.Parameters.AddWithValue("@ID", id);
         DataTable permissionData = DBServer.ExecuteDataTable(command);
         if (permissionData.Rows.Count == 0)
         {
             return(null);
         }
         return(permissionData.ConvertList <AppPermission>());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }