⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file.cs

📁 oa办公系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Collections;

/// <summary>
/// file 的摘要说明
/// </summary>
public class file
{
	public file()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}
   /// <summary>
   /// 上传文档
   /// </summary>
   /// <param name="arrfile">获取上传文件的信息</param>
    public void add_file(ArrayList arrfile)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("uploadFile", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@s_id", SqlDbType.Int).Value = arrfile[0];
        cmd.Parameters.Add("@df_name", SqlDbType.VarChar, 50).Value = arrfile[1];
        cmd.Parameters.Add("@df_type", SqlDbType.VarChar, 20).Value = arrfile[2];
        cmd.Parameters.Add("@df_length", SqlDbType.Int).Value = arrfile[3];
        cmd.Parameters.Add("@df_explain", SqlDbType.Text).Value = arrfile[4];
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
        finally
        {
            con.Close();
        }
    }
    /// <summary>
    /// 删除文档信息
    /// </summary>
    /// <param name="df_id">文档的编号</param>
    /// <param name="s_id">上传文档的用户ID号</param>
    public void delete_file(int df_id, int s_id)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("delete_file", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@df_id", SqlDbType.Int).Value = df_id;
        cmd.Parameters.Add("@s_id", SqlDbType.Int).Value = s_id;
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
        finally
        {
            con.Close();
        }
    }

    /// <summary>
    /// 显示下载的文档信息
    /// </summary>
    /// <param name="s_id">登录用户的ID号</param>
    /// <returns>返回的是一个数据视图类型</returns>
    public DataView select_file(int s_id)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter("select_file", con);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@s_id", SqlDbType.Int).Value = s_id;
        DataSet ds = new DataSet();
        sda.Fill(ds,"file");
        DataView dv = ds.Tables[0].DefaultView;
        return dv;
    }

    /// <summary>
    /// 获取下载文件的详细信息
    /// </summary>
    /// <param name="df_id">下载文件的编号</param>
    /// <returns>数据读对象</returns>
    public SqlDataReader downfileInfo(int df_id)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("select_fileInfo", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@df_id", SqlDbType.Int).Value = df_id;
        SqlDataReader dr = cmd.ExecuteReader();
        return dr;
    }


    //-----------------公文流转---------------


    /// <summary>
    /// 新建公文流转
    /// </summary>
    /// <param name="arr">公文流传的基本信息,如名称 接收人等</param>
    public void Insert_Flow(ArrayList arr)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("Upload_Flow", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@Send_sid", SqlDbType.Int).Value = arr[0];
        cmd.Parameters.Add("@Send_name", SqlDbType.VarChar,50).Value = arr[1];
        cmd.Parameters.Add("@receive_sid", SqlDbType.Int).Value=arr[2];
        cmd.Parameters.Add("@doc_name", SqlDbType.VarChar,200).Value=arr[3];
        cmd.Parameters.Add("@doc_file", SqlDbType.VarChar,100).Value=arr[4];
        cmd.Parameters.Add("@doc_explain", SqlDbType.Text).Value=arr[5];
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
        finally
        {
            con.Close();
        }
    }


    /// <summary>
    /// 查看公文
    /// </summary>
    /// <param name="UserID">查看公文的用户ID号</param>
    /// <returns>返回DataView对象</returns>
    public DataView Select_Flow(int UserID)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter("Select_Flow", con);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@receive_sid", SqlDbType.Int).Value = UserID;
        DataSet ds = new DataSet();
        sda.Fill(ds, "Flow");
        DataView dv = ds.Tables[0].DefaultView;
        return dv;
    }

    /// <summary>
    /// 删除公文流转
    /// </summary>
    /// <param name="Flow_id">公文的ID号</param>
    public void Delete_Flow(int Flow_id)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("Delete_Flow", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@doc_id", SqlDbType.Int).Value =Flow_id;
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
        finally
        {
            con.Close();
        }
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -