public static bool UpdateFileAccessCount(int fileId, int UserID)
 {
     try
     {
         SqlCommand cmd = ConnectSQL.ExecuteProcedure("spUpdateFileStatus");
         cmd.Parameters.AddWithValue("@FileID", fileId);
         cmd.Parameters.AddWithValue("@UserID", UserID);
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #2
0
        public static List <User> UserAllUser(int FileId)
        {
            List <User> userlist = new List <User>();

            try
            {
                SqlCommand cmd = ConnectSQL.ExecuteProcedure("SpFileAccess");
                cmd.Parameters.AddWithValue("@FileId", FileId);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    while (rdr.Read())
                    {
                        User user = new User();
                        user.UserID    = (int)rdr["UserID"];
                        user.Username  = rdr["Username"].ToString();
                        user.Rowstatus = Convert.ToChar(rdr["Rowstatus"]);
                        userlist.Add(user);
                    }
                }
                else
                {
                    rdr.Dispose();
                    cmd.Dispose();
                    cmd = ConnectSQL.ExecuteCommand("select UserID,Username,Rowstatus from inz_USERS");
                    rdr = cmd.ExecuteReader();
                    if (rdr.HasRows)
                    {
                        while (rdr.Read())
                        {
                            User user = new User();
                            user.UserID    = (int)rdr["UserID"];
                            user.Username  = rdr["Username"].ToString();
                            user.Rowstatus = Convert.ToChar(rdr["Rowstatus"]);
                            userlist.Add(user);
                        }
                    }
                }



                return(userlist);
            }
            catch
            {
                return(userlist);
            }
        }
 public static bool SaveFileAccess(int UserId, int FileId, string Status)
 {
     try
     {
         SqlCommand cmd = ConnectSQL.ExecuteProcedure("spUpdateFileAccess");
         cmd.Parameters.AddWithValue("@FileId", FileId);
         cmd.Parameters.AddWithValue("@UserId", UserId);
         cmd.Parameters.AddWithValue("@Status", Status);
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #4
0
 public static bool SaveFileToDatabase(FileEntity file)
 {
     try
     {
         SqlCommand cmd = ConnectSQL.ExecuteProcedure("spInsertFileDetails");
         cmd.Parameters.AddWithValue("@FileName", file.Name);
         cmd.Parameters.AddWithValue("@description", file.Description);
         cmd.Parameters.AddWithValue("@Key", file.Key);
         cmd.Parameters.AddWithValue("@UserId", file.UserId);
         cmd.Parameters.AddWithValue("@IsEncrypted", 1);
         cmd.Parameters.AddWithValue("@FileType", file.FileType);
         cmd.Parameters.AddWithValue("@Document", file.Document);
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch
     {
         return(false);
     }
 }