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

📄 message.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>
/// message 的摘要说明
/// </summary>
public class message
{
	public message()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}
    //将发送的站内信息插入到发件箱
    public void SendMessageBox(ArrayList arrsend)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("SendMessage", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@s_Sendid",SqlDbType.Int).Value=arrsend[0];
        cmd.Parameters.Add("@s_receive",SqlDbType.VarChar,50).Value=arrsend[1];
        cmd.Parameters.Add("@s_subject",SqlDbType.Text).Value=arrsend[2];
        cmd.Parameters.Add("@s_Content",SqlDbType.Text).Value=arrsend[3];	
        try
        {
            cmd.ExecuteNonQuery();
            con.Close();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
        finally
        {
            con.Close();
        }
    }
    //将发送的站内信息插入到收件箱
    public void ReveiveMessageBox(ArrayList arrrevice)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("receivemessage", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@r_Send", SqlDbType.VarChar,50).Value =arrrevice[0];
        cmd.Parameters.Add("@r_receive", SqlDbType.VarChar, 50).Value =arrrevice[1];
        cmd.Parameters.Add("@r_receiveid", SqlDbType.Int).Value =arrrevice[2];
        cmd.Parameters.Add("@r_subject", SqlDbType.Text).Value = arrrevice[3];
        cmd.Parameters.Add("@r_Content", SqlDbType.Text).Value = arrrevice[4];
        cmd.Parameters.Add("@r_important", SqlDbType.VarChar, 20).Value = arrrevice[5];
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
        finally
        {
            con.Close();
        }
    }

    //获取发件箱中的数据
    public DataSet Sel_SendBox(int uid)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlDataAdapter sda=new SqlDataAdapter("sel_sendmessageBox", con);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@s_Sendid", SqlDbType.Int).Value = uid;
        DataSet ds = new DataSet();
        sda.Fill(ds, "sendbox");
        return ds;
        //DataView dv = ds.Tables["sendbox"].DefaultView;
        //return dv;
    }
    //删除发件箱中信息
    public void del_sendbox(int id)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("del_sendbox", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@s_id", SqlDbType.Int).Value = id;
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
    }


    //查询收件箱中的信息
    public DataSet Sel_ReceiveBox(int uid)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter("sel_receivebox", con);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@r_receiveid", SqlDbType.Int).Value = uid;
        DataSet ds = new DataSet();
        sda.Fill(ds, "sendbox");
        return ds;
        
    }

    //删除收件箱中的信息
    public void del_receivebox(int id)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("del_receivebox", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@r_id", SqlDbType.Int).Value = id;
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
    }


    //发送请假信息
    public void Send_holidayMessage(ArrayList holiday)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("SendHoliday_Message", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@s_id", SqlDbType.Int).Value =holiday[0];
        cmd.Parameters.Add("@s_name", SqlDbType.VarChar,50).Value =holiday[1];
        cmd.Parameters.Add("@v_name", SqlDbType.VarChar, 20).Value = holiday[2];
        cmd.Parameters.Add("@v_cause", SqlDbType.Text).Value = holiday[3];
        cmd.Parameters.Add("@v_datanum", SqlDbType.Int).Value = holiday[4];
        cmd.Parameters.Add("@v_starttime", SqlDbType.DateTime).Value = holiday[5];
        cmd.Parameters.Add("@v_endtime", SqlDbType.DateTime).Value = holiday[6];
        cmd.Parameters.Add("@v_SendTime", SqlDbType.DateTime).Value = holiday[7];
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
    }

    //查询所有的请假信息(管理审核)
    public DataView sel_holidayMessage()
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter("sel_AllHoliday", con);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        DataSet ds = new DataSet();
        sda.Fill(ds,"select_examine");
        DataView dv = ds.Tables["select_examine"].DefaultView;
        return dv;
    }

    //查询个人的请假信息
    public DataView sel_people_vacation(int s_id)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter("sel_people_vacation", con);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@s_id", SqlDbType.Int).Value = s_id;
        DataSet ds = new DataSet();
        sda.Fill(ds, "sel_p_vacation");
        DataView dv = ds.Tables["sel_p_vacation"].DefaultView;
        return dv;
    }
    
    //查询请假的详细信息
    public SqlDataReader sel_vacationInformation(int vacation_id)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("sel_vacationInfo", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@v_id", SqlDbType.Int).Value = vacation_id;
        SqlDataReader dr = cmd.ExecuteReader();
        return dr;
    }

    //领导审核请假信息
    public void check_vacation(ArrayList arr_check)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("vacation_examine", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@v_id", SqlDbType.Int).Value = arr_check[0];
        cmd.Parameters.Add("@v_status", SqlDbType.VarChar, 20).Value = arr_check[1];
        cmd.Parameters.Add("@v_Repaly", SqlDbType.Text).Value = arr_check[2];
        cmd.Parameters.Add("@v_RepalyPeople", SqlDbType.VarChar, 50).Value = arr_check[3];
        cmd.Parameters.Add("@v_replaytime", SqlDbType.DateTime).Value = arr_check[4];
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
    }

    //删除请假信息
    public void del_vacation(int id)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["office"].ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("del_vacation", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@v_id", SqlDbType.Int).Value =id;
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception err)
        {
            throw new System.Exception(err.Message);
        }
    }

}

⌨️ 快捷键说明

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