Esempio n. 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (drpFltype.SelectedIndex != 0 && !string.IsNullOrEmpty(drpFlow.SelectedItem.Text))
            {
                string    title  = this.txtTitle.Text;
                int       urgent = Convert.ToInt32(this.drpUrgent.SelectedIndex);
                int       flowid = Convert.ToInt32(this.drpFlow.SelectedItem.Value);
                Sqlselete ss     = new Sqlselete();
                int       userid = Convert.ToInt32(ss.SelectEmpByUserName(Session["UserName"].ToString()));
                //string FileName = this.FileUpload1.PostedFile.FileName;
                string content = this.TextBox2.Text;
                string src     = "";
                if (Request.QueryString["id"] != null)
                {
                    string sql = "update FlowDoc set Title='" + title + "',Content='" + content + "'";
                    if (OperateDB.ExecuteNonQuery(sql) > 0)
                    {
                        Response.Write("<script language=javascript>alert('保存成功!');</script>");
                    }
                    else
                    {
                        Response.Write("<script language=javascript>alert('保存失败!');</script>");
                    }
                }
                else
                {
                    if (!Directory.Exists(Server.MapPath(".") + "\\Files\\"))
                    {
                        Directory.CreateDirectory(Server.MapPath(".") + "\\Files\\");
                    }

                    if (FileUpload1.PostedFile.ContentLength == 0)
                    {
                        src = "";
                    }
                    else
                    {
                        string   strFilePath = FileUpload1.PostedFile.FileName;
                        FileInfo fl          = new FileInfo(strFilePath);
                        string   Ext         = fl.Name;

                        src = Ext;
                        string ServerPath  = Server.MapPath(".");
                        string strSeraPath = ServerPath + "\\Files\\" + src;
                        FileUpload1.PostedFile.SaveAs(strSeraPath);
                    }


                    string strSql = "insert into FlowDoc values('" + title + "'," + urgent + "," + flowid + ",1," + userid + ",'" + content + "',default,1,0,'" + src + "')";
                    if (OperateDB.ExecuteNonQuery(strSql) > 0)
                    {
                        Response.Write("<script>alert('保存成功!');</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('保存失败!');</script>");
                    }
                }
            }
        }
Esempio n. 2
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        Sqlselete ss = new Sqlselete();

        try
        {
            int           userid = Convert.ToInt32(ss.SelectEmpByUserName(Session["UserName"].ToString()));
            SqlConnection con    = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
            con.Open();
            string     sql = "insert into Flow values('" + this.flowname.Text + "'," + this.flowtype.SelectedItem.Value + ",'" + this.flowcontent.Text + "',1," + userid + ")";
            SqlCommand com = new SqlCommand(sql, con);
            if (com.ExecuteNonQuery() > 0)
            {
            }
            else
            {
                Response.Write("<script>alert('保存失败!');</script>");
            }
            con.Close();
            Bind();
        }
        catch (Exception)
        {
            Response.Write("<script>alert('登录超时,请重新登录!');window.location.href='../Login.aspx'</script>");
        }
    }
Esempio n. 3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            string id = this.GridView1.DataKeys[this.GridView1.SelectedIndex]["ID"].ToString();

            Sqlselete     ss     = new Sqlselete();
            int           userid = Convert.ToInt32(ss.SelectEmpByUserName(Session["UserName"].ToString()));
            SqlConnection con    = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
            con.Open();
            string     sql = "update Flow set Name='" + this.flowname.Text + "',TypeID=" + this.flowtype.SelectedItem.Value + ",Des='" + this.flowcontent.Text + "',UserID=" + userid + "where ID=" + id;
            SqlCommand com = new SqlCommand(sql, con);
            if (com.ExecuteNonQuery() > 0)
            {
            }
            else
            {
                Response.Write("<script>alert('保存失败!');</script>");
            }
            con.Close();
            Bind();
        }
        catch (Exception)
        {
            Response.Write("<script>alert('登录超时,请重新登录!');window.location.href='../Login.aspx'</script>");
        }
    }
Esempio n. 4
0
        public void Bind()
        {
            Sqlselete ss     = new Sqlselete();
            int       userid = Convert.ToInt32(ss.SelectEmpByUserName(Session["UserName"].ToString()));
            string    sql    = "select * from FlowDoc where UserID=" + userid;
            DataSet   ds     = ss.Getds(sql);

            this.GridView1.DataSource = ds.Tables[0];
            this.GridView1.DataBind();
        }
Esempio n. 5
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            Sqlselete ss = new Sqlselete();

            try
            {
                int    userid = Convert.ToInt32(ss.SelectEmpByUserName(Session["UserName"].ToString()));
                string sql    = "insert into Flow values('" + this.flowname.Text + "'," + this.flowtype.SelectedItem.Value + ",'" + this.flowcontent.Text + "',1," + userid + ")";
                if (OperateDB.ExecuteNonQuery(sql) > 0)
                {
                }
                else
                {
                    Response.Write("<script>alert('保存失败!');</script>");
                }
                Bind();
            }
            catch (Exception)
            {
                Response.Write("<script>alert('登录超时,请重新登录!');window.location.href='../Login.aspx'</script>");
            }
        }
Esempio n. 6
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (drpFltype.SelectedIndex != 0 && !string.IsNullOrEmpty(drpFlow.SelectedItem.Text))
            {
                //插入申请
                string    sql;
                string    title  = this.txtTitle.Text;
                int       urgent = Convert.ToInt32(this.drpUrgent.SelectedIndex);
                int       flowid = Convert.ToInt32(this.drpFlow.SelectedItem.Value);
                Sqlselete ss     = new Sqlselete();
                int       userid = Convert.ToInt32(ss.SelectEmpByUserName(Session["UserName"].ToString()));
                //string FileName = this.FileUpload1.PostedFile.FileName;
                string content = this.TextBox2.Text.ToString();
                string src     = "";
                if (Request.QueryString["id"] != null)
                {
                    sql = "update FlowDoc set Title='" + title + "',Content='" + content + "',IsSave=0";
                    if (OperateDB.ExecuteNonQuery(sql) != 1)
                    {
                        Response.Write("<script>alert('发送失败!');</script>");
                        return;
                    }
                    sql = "select top 1 Num from Path where FlowID=" + Convert.ToInt32(Request.QueryString["id"]) + " order by Num desc";
                    int approve = Convert.ToInt32(OperateDB.getExecuteScalar(sql));

                    sql = "select Num from Path where UserID=" + userid;
                    int num = Convert.ToInt32(OperateDB.getExecuteScalar(sql));

                    sql = "select * from Path where FlowID=" + flowid;

                    DataSet ds = OperateDB.ExecuteDataSet(sql);


                    //int result = 0;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        if (Convert.ToInt32(dr["UserID"]) == userid)
                        {
                            string strSql = "insert into FlowPath (DocID,FlowID,StepID,UserID,IsApprove,Num,IsJoin) values(" + Convert.ToInt32(Request.QueryString["id"]) + "," +
                                            Convert.ToInt32(dr["FlowID"]) + "," + Convert.ToInt32(dr["ID"]) + "," + dr["UserID"].ToString() + "," + (approve - Convert.ToInt32(dr["Num"])) + "," + dr["Num"].ToString() + "," + dr["IsJoin"].ToString() + ")";
                            if (OperateDB.ExecuteNonQuery(strSql) != 1)
                            {
                                Response.Write("<script>alert('发送失败!');</script>");
                                return;
                            }
                            continue;
                        }
                        if (Convert.ToInt32(dr["Num"]) > num)
                        {
                            string strsql = "insert into FlowPath (DocID,FlowID,StepID,UserID,IsApprove,Num,IsJoin) values(" + Convert.ToInt32(Request.QueryString["id"]) + "," +
                                            Convert.ToInt32(dr["FlowID"]) + "," + Convert.ToInt32(dr["ID"]) + "," + dr["UserID"].ToString() + "," + (approve - Convert.ToInt32(dr["Num"])) + "," + dr["Num"].ToString() + "," + dr["IsJoin"].ToString() + ")";
                            if (OperateDB.ExecuteNonQuery(strsql) != 1)
                            {
                                Response.Write("<script>alert('发送失败!');</script>");
                                return;
                            }
                        }
                    }
                }
                else
                {
                    if (!Directory.Exists(Server.MapPath(".") + "\\Files\\"))
                    {
                        Directory.CreateDirectory(Server.MapPath(".") + "\\Files\\");
                    }

                    if (FileUpload1.PostedFile.ContentLength == 0)
                    {
                        src = "";
                    }
                    else
                    {
                        string   strFilePath = FileUpload1.PostedFile.FileName;
                        FileInfo fl          = new FileInfo(strFilePath);
                        string   Ext         = fl.Name;

                        src = Ext;
                        string ServerPath  = Server.MapPath(".");
                        string strSeraPath = ServerPath + "\\Files\\" + src;
                        FileUpload1.PostedFile.SaveAs(strSeraPath);
                    }

                    string strSql1 = "insert into FlowDoc values('" + title + "'," + urgent + "," + flowid + ",1," + userid + ",'" + content + "',default,1,0,'" + src + "')";
                    if (OperateDB.ExecuteNonQuery(strSql1) != 1)
                    {
                        Response.Write("<script>alert('发送失败!');</script>");
                        return;
                    }

                    //插入申请审批路径
                    sql = "select top 1 ID from FlowDoc order by PubDate desc";
                    int docid = Convert.ToInt32(OperateDB.getExecuteScalar(sql));

                    sql = "select top 1 Num from Path where FlowID=" + flowid + " order by Num desc";
                    int approve = Convert.ToInt32(OperateDB.getExecuteScalar(sql));

                    sql = "select Num from Path where UserID=" + userid;
                    int num = Convert.ToInt32(OperateDB.getExecuteScalar(sql));//序号

                    sql = "select * from Path where FlowID=" + flowid;
                    DataSet ds = OperateDB.ExecuteDataSet(sql);
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        if (Convert.ToInt32(dr["UserID"]) == userid)
                        {
                            string strSql = "insert into FlowPath (DocID,FlowID,StepID,UserID,IsApprove,Num,IsJoin) values(" + docid + "," +
                                            Convert.ToInt32(dr["FlowID"]) + "," + Convert.ToInt32(dr["ID"]) + "," + dr["UserID"].ToString() + "," + (approve - Convert.ToInt32(dr["Num"])) + "," + dr["Num"].ToString() + "," + dr["IsJoin"].ToString() + ")";
                            if (OperateDB.ExecuteNonQuery(strSql) != 1)
                            {
                                Response.Write("<script>alert('发送失败!');</script>");
                                return;
                            }
                            continue;
                        }
                        if (Convert.ToInt32(dr["Num"]) > num)
                        {
                            string strsql = "insert into FlowPath (DocID,FlowID,StepID,UserID,IsApprove,Num,IsJoin) values(" + docid + "," +
                                            Convert.ToInt32(dr["FlowID"]) + "," + Convert.ToInt32(dr["ID"]) + "," + dr["UserID"].ToString() + "," + (approve - Convert.ToInt32(dr["Num"])) + "," + dr["Num"].ToString() + "," + dr["IsJoin"].ToString() + ")";
                            if (OperateDB.ExecuteNonQuery(strsql) != 1)
                            {
                                Response.Write("<script>alert('发送失败!');</script>");
                                return;
                            }
                        }
                    }
                }
            }
        }