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

📄 insertchengyuan.aspx.cs

📁 OA自动化办公系统,就是OA自动化办公系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 COM.OA.BLL;
using System.Collections.Generic;
using COM.OA.Entity;
using System.Data.SqlClient;
public partial class insertchengyuan : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //取群ID
        string qid = this.Request["qunid"];
        //如果群ID=空,则跳回qunzu.aspx页
        if (qid == null)
        {
            this.Response.Write(string.Format(GetRedirect.REDIRECT, "qunzu.aspx"));
        }
        else
        {
            //string qid = this.Request.Form["Hidqunid"];

            //把string类型群ID转换成int            
            int qunid = Int32.Parse(qid);
            //设置SqlParameter,为存储过程传值
            SqlParameter parambumen = new SqlParameter("@u_g_id", qunid);
            //调用存储过程 
            IList<qunzuchengyuan> lists = BLLGeneric.Select<qunzuchengyuan>(CommandType.StoredProcedure, "qunzuchengyuan", parambumen);
            //判断取出的数据是否为空
            if (lists.Count == 0)
            {
                this.Response.Write("本组暂无成员");
            }
             //不为空往GIDV里填充数据
            else
            {
                this.Gidv_qunchengyuan.DataSource = lists;
                qunzuchengyuan gg = lists[0];

                //this.Gidv_qunchengyuan
                this.Gidv_qunchengyuan.DataBind();
            }
        }

    }
    protected void ddl_bumen_SelectedIndexChanged(object sender, EventArgs e)
    {
        //取部门
        String bumen = this.ddl_bumen.Text;
        // String where = "em_dept_id='{0}'";
        //  where = string.Format(where,bumen);
        //   IList<employee> list = employeeBLL.Select(where);

        //设置SqlParameter,为存储过程传值
        SqlParameter parambumen = new SqlParameter("@deptid", bumen);
        //调用存储过程 
        IList<liandongren> lists = BLLGeneric.Select<liandongren>(CommandType.StoredProcedure, "liandong", parambumen);

            this.ddl_duixiang.DataSource = lists;
            this.ddl_duixiang.DataTextField = "Em_name";
            this.ddl_duixiang.DataValueField = "Em_name";
            //this.ddl_duixiang.DataValueField = "Em_id";
            this.ddl_duixiang.DataBind();       
    }

    protected void Button4_Click(object sender, EventArgs e)
    {
        this.txt_jieshouren.Text = "";
    }
    //添加接收人
    protected void Button1_Click(object sender, EventArgs e)
    {

        string duixiang = this.ddl_duixiang.Text;
        if (duixiang == null)
        {
            this.Response.Write(string.Format(GetRedirect.REDIRECT, "qunzu.aspx"));
        }
        else
        {
            this.txt_jieshouren.Text = duixiang;
        }
    }
    //差备注
    protected void Button2_Click(object sender, EventArgs e)
    {
        
        //取插入人姓名
        string insertname=this.txt_jieshouren.Text;
        if (insertname == null || insertname == "")
        {
            this.Response.Write(string.Format(GetRedirect.WINALERT,"接收人不能为空"));
            this.txt_jieshouren.Focus();
        }
        //取群ID
        string qid = this.Request.Form["Hidqunid"];
        //把群ID转换成int类型
        int qunid = Int32.Parse(qid);
        //取群名
        string qunming=this.Request.Form["Txt_qunming"];
        //设置where语句
        String where = "g_groupname='{0}'";
        where = string.Format(where,qunming);
        //查询
        IList<groups> list=groupsBLL.Select(where);
        //判断是否为空
        if (list.Count != 0)
        {
            //用实体取群组
            groups g = list[0];
            //设置where语句
            String userwhere = "em_name='{0}'";
            userwhere = string.Format(userwhere, insertname);
            //查询
            IList<employee> ulist = employeeBLL.Select(userwhere);
            employee emp = ulist[0];
            int jieshoureni = emp.em_id;
            String where2 = "u_em_id='{0}'";
            where2 = string.Format(where2, jieshoureni);
            IList<users> uuu = usersBLL.Select(where2);
            if (uuu.Count != 0)
            {
               //更新
                users u = uuu[0];                
                u.u_g_id = g.g_id;               
                usersBLL.Update(u);
                this.Response.Write(string.Format(GetRedirect.WINALERT,"保存成功"));
                this.Response.Write(string.Format(GetRedirect.REDIRECT, "insertchengyuan.aspx"));
            }
        }
    }
    protected void Gidv_qunchengyuan_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes["onmouseover"] = "orgColor=this.style.backgroundColor;this.style.backgroundColor='#d5eebb';";
            e.Row.Attributes["onmouseout"] = "this.style.backgroundColor=orgColor;";
        }
    }
}

⌨️ 快捷键说明

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