Пример #1
0
        public string FileUploadMethod(string fn, string path, Stream fs, string fc, string gfn, int id)
        {
            string givingFilename = gfn;
            string filename       = fn;
            string contentType    = fc;
            int    FolderID       = id;

            using (fs)
            {
                using (BinaryReader br = new BinaryReader(fs))
                {
                    byte[] bytes = br.ReadBytes((Int32)fs.Length);

                    using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Database"].ConnectionString))
                    {
                        SqlCommand cmd = new SqlCommand("db_owner.UploadFile", con);
                        cmd.CommandType = CommandType.StoredProcedure;
                        {
                            cmd.Connection = con;

                            cmd.Parameters.AddWithValue("@GName", givingFilename);
                            cmd.Parameters.AddWithValue("@Name", filename);
                            cmd.Parameters.AddWithValue("@ContentType", contentType);
                            cmd.Parameters.AddWithValue("@Data", bytes);
                            cmd.Parameters.AddWithValue("@ID", id);
                            cmd.Parameters.AddWithValue("@UserID", Model_Layer.SessionData.SessionUserID);
                            con.Open();
                            msg = HelperOutputMsgs.printMessage(cmd.ExecuteNonQuery());
                            con.Close();
                            return(msg);
                        }
                    }
                }
            }
        }
Пример #2
0
        public string DeleteFolderDB(int ID)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Database"].ConnectionString);

            con.Open();
            SqlCommand cmd = new SqlCommand("db_owner.DeleteFolder", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@ID", ID));

            msg = HelperOutputMsgs.printMessage(cmd.ExecuteNonQuery());

            con.Close();
            con.Dispose();
            return(msg);
        }
Пример #3
0
        public string UploadLinkDB(string Name, string Url)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Database"].ConnectionString);

            con.Open();
            SqlCommand cmd = new SqlCommand("db_owner.UploadLink", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@Name", Name));
            cmd.Parameters.Add(new SqlParameter("@Url", Url));
            msg = HelperOutputMsgs.printMessage(cmd.ExecuteNonQuery());

            con.Close();
            con.Dispose();

            return(msg);
        }