protected void Button8_Click(object sender, EventArgs e)
    {
        foreach (DataListItem item in this.DataList1.Items)
        {
            CheckBox    CB         = (CheckBox)item.FindControl("CheckBox1");
            HiddenField HF         = (HiddenField)item.FindControl("HiddenField1");
            string      UID        = HF.Value.ToString();
            string      CreateTime = DateTime.Now.ToString();
            string      sqls       = "select UID from Ass_User where AssId=" + AssId + "and  UID=" + UID;
            if (CB.Checked == true)
            {
                DataAccess da = new DataAccess();
                DataSet    ds = da.dataSet(sqls);
                if (ds.Tables[0].Rows.Count == 0)
                {
                    sqls = "INSERT INTO Ass_User VALUES ('" + AssId + "','" + UID + "','" + CreateTime + "')";
                    da.ExecuteSql(sqls);
                }
            }
            else
            {
                DataAccess da = new DataAccess();
                DataSet    ds = da.dataSet(sqls);
                if (ds == null || ds.Tables[0].Rows.Count != 0)
                {
                    sqls = "delete from Ass_User where AssId=" + AssId + "and  UID=" + UID;
                    da.ExecuteSql(sqls);
                }
            }
        }
        universal un = new universal();

        un.Alert("修改成功", this);
        DataList1.DataBind();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        DataAccess da       = new DataAccess();
        string     sqls     = "select Password from User_ where UID='" + Session["UID"].ToString() + "'";
        DataSet    ds       = da.dataSet(sqls);
        string     Password = ds.Tables[0].Rows[0]["Password"].ToString();
        universal  un       = new universal();

        if (TextBox3.Text == Password)
        {
            if (TextBox5.Text == TextBox6.Text)
            {
                sqls = "UPDATE User_ SET Password = '******' WHERE UID = '" + Session["UID"].ToString() + "'";
                da.ExecuteSql(sqls);
                un.Alert("修改成功", this);
            }
            else
            {
                un.Alert("新密码确认失败,请两次输入相同的新密码", this);
            }
        }
        else
        {
            un.Alert("旧密码确认失败,请确认后再次输入", this);
        }
        TextBox3.Text = "";
    }
Exemple #3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataAccess da = new DataAccess();
        universal  un = new universal();

        if (TextArea1.Value != "")
        {
            string SendUID    = Session["UID"].ToString();
            string ReceiveUID = Request.QueryString["UID"].ToString();
            string Detail     = TextArea1.Value;
            string SendTime   = DateTime.Now.ToString();
            string sqls       = "INSERT INTO Letter VALUES ('" + SendUID + "','" + ReceiveUID + "','" + Detail + "','" + SendTime + "','" + "0')";
            da.ExecuteSql(sqls);
            un.Alert("发送成功", this);
            sqls = "select SendUID from Letter where (SendUID=" + ReceiveUID + ") and (ReceiveUID=" + SendUID + ")";
            DataSet ds = da.dataSet(sqls);
            if (ds.Tables[0].Rows.Count == 0)
            {
                sqls = "INSERT INTO Letter VALUES ('" + ReceiveUID + "','" + SendUID + "',' ','" + SendTime + "','" + "0')";
                da.ExecuteSql(sqls);
            }
        }
        else
        {
            un.Alert("发送内容不得为空", this);
        }

        TextArea1.Value = "";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        universal un = new universal();

        if (FileUpload1.HasFile)
        {
            string savePath = Server.MapPath("~/file/"); //指定上传文件在服务器上的保存路径
            //检查服务器上是否存在这个物理路径,如果不存在则创建
            if (!System.IO.Directory.Exists(savePath))
            {
                System.IO.Directory.CreateDirectory(savePath);
            }
            savePath = savePath + "\\" + FileUpload1.FileName;
            FileUpload1.SaveAs(savePath);
            DataAccess da           = new DataAccess();
            string     CreateTime   = DateTime.Now.ToString();
            string     BelongUID    = Session["UID"].ToString();
            string     FileName     = FileUpload1.FileName.ToString();
            string     BelongItemId = Session["ItemId"].ToString();
            string     sqls         = "INSERT INTO File_ (CreateTime, BelongUID,FileName,BelongItemId) VALUES ('" + CreateTime + "','" + BelongUID + "','" + FileName + "','" + BelongItemId + "')";
            da.ExecuteSql(sqls);
            alertv al = new alertv();
            Response.Write(al.gutAlertUrl("上传成功", "file.aspx"));
        }
        else
        {
            un.Alert("你还没有选择上传文件!", this);
        }
    }
Exemple #5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        universal un  = new universal();
        bool      Err = true;

        if (TextBox1.Text == "")
        {
            Err = false;
            un.Alert("项目名不得为空", this);
        }
        if (TextBox3.Text == "")
        {
            Err = false;
            un.Alert("项目简介不得为空", this);
        }
        if (Err)
        {
            string Name     = TextBox1.Text;
            string Intro    = TextBox3.Text;
            string IsPublic = "1";
            if (CheckBox2.Checked == true)
            {
                IsPublic = "0";
            }
            string Detail     = textarea1.Value;
            string UserNumber = "";
            if (TextBox2.Text != "")
            {
                UserNumber = TextBox2.Text;
            }
            string IconCode   = "&#xe685";
            string CreateTime = DateTime.Now.ToString();
            foreach (DataListItem item in this.DataList1.Items)
            {
                RadioButton RB = (RadioButton)item.FindControl("RB");
                Label       LB = (Label)item.FindControl("LB");
                if (RB.Checked == true)
                {
                    IconCode = LB.Text;
                }
            }
            string     sqls = "INSERT INTO Item (Name, Intro,IsPublic,Detail,UserNumber,IconCode,CreateTime) VALUES ('" + Name + "','" + Intro + "','" + IsPublic + "','" + Detail + "','" + UserNumber + "','" + IconCode + "','" + CreateTime + "')";
            DataAccess da   = new DataAccess();
            da.ExecuteSql(sqls);
            sqls = "SELECT ItemId FROM Item WHERE Name='" + Name + "' ORDER BY ItemId";
            DataSet ds     = da.dataSet(sqls);
            string  UID    = Session["UID"].ToString();
            string  ItemId = ds.Tables[0].Rows[0]["ItemId"].ToString();
            sqls = "INSERT INTO Item_User VALUES('" + UID + "','" + ItemId + "','1','','1')";
            da.ExecuteSql(sqls);
            sqls = "INSERT INTO List(Name,Array,BelongItem) VALUES('默认列表','1','" + ItemId + "')";
            da.ExecuteSql(sqls);

            alertv al = new alertv();
            Response.Write(al.gutAlertUrl("创建成功", "../item/item-list.aspx"));
        }
    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        string        TagId  = "";
        string        strCon = "Data Source=LENOVO-PC;Initial Catalog=Database;User ID=workbar;Password=123123123";
        SqlConnection conn   = new SqlConnection(strCon);

        conn.Open();
        SqlCommand cmd = new SqlCommand();

        cmd.Parameters.Add(new SqlParameter("@TagName", SqlDbType.NVarChar, 16));
        cmd.Parameters["@TagName"].Value = TextBox4.Text;
        cmd.Connection  = conn;
        cmd.CommandText = "SELECT Tag.TagId FROM dbo.Tag WHERE Tag.TagName=@TagName";
        SqlDataReader reader = cmd.ExecuteReader();

        if (reader.Read())
        {
            TagId = reader["TagId"].ToString();
        }
        else
        {
            reader.Close();
            cmd.CommandText = "INSERT INTO Tag (TagName) VALUES (@TagName)";
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch { }

            cmd.CommandText = "SELECT Tag.TagId FROM dbo.Tag WHERE Tag.TagName=@TagName";
            reader          = cmd.ExecuteReader();
            if (reader.Read())
            {
                TagId = reader["TagId"].ToString();
            }
        }
        reader.Close();
        conn.Close();

        DataAccess da         = new DataAccess();
        string     CreateTime = DateTime.Now.ToString();
        string     sqls       = "select AssId from Ass_Tag where AssId='" + AssId + "' and TagId='" + TagId + "'";
        DataSet    ds         = da.dataSet(sqls);

        if (ds.Tables[0].Rows.Count == 0)
        {
            sqls = "INSERT INTO Ass_Tag VALUES ('" + AssId + "','" + TagId + "')";
            da.ExecuteSql(sqls);
            DataList2.DataBind();
        }
        else
        {
            universal un = new universal();
            un.Alert("请不要重复输入", this);
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        universal un  = new universal();
        bool      Err = true;

        if (TextBox1.Text == "")
        {
            Err = false;
            un.Alert("项目名不得为空", this);
        }
        if (TextBox3.Text == "")
        {
            Err = false;
            un.Alert("项目简介不得为空", this);
        }
        if (Err)
        {
            string Name     = TextBox1.Text;
            string Intro    = TextBox3.Text;
            string IsPublic = "1";
            if (CheckBox2.Checked == true)
            {
                IsPublic = "0";
            }
            string Detail     = textarea1.Value;
            string UserNumber = "";
            if (TextBox2.Text != "")
            {
                UserNumber = TextBox2.Text;
            }
            string IconCode   = "&#xe685";
            string CreateTime = DateTime.Now.ToString();
            foreach (DataListItem item in this.DataList1.Items)
            {
                RadioButton RB = (RadioButton)item.FindControl("RB");
                Label       LB = (Label)item.FindControl("LB");
                if (RB.Checked == true)
                {
                    IconCode = LB.Text;
                }
            }
            string     sqls = "Update Item  SET Name='" + Name + "', Intro='" + Intro + "',IsPublic='" + IsPublic + "',Detail='" + Detail + "',UserNumber='" + UserNumber + "',IconCode='" + IconCode + "',CreateTime='" + CreateTime + "'  where ItemId=" + Session["ItemId"].ToString();
            DataAccess da   = new DataAccess();
            da.ExecuteSql(sqls);


            alertv al = new alertv();
            Response.Write(al.gutAlertUrl("修改成功", "../item/item-list.aspx"));
        }
    }
    protected void Button1_Click1(object sender, EventArgs e)
    {
        universal thisUn     = new universal();
        string    ThisDetail = TL.Value;

        if (ThisDetail != "")
        {
            DataAccess DA         = new DataAccess();
            string     ThisUID    = Session["UID"].ToString();
            string     ThisItemId = Session["ItemId"].ToString();
            //int ii = dt.GetHashCode();
            string ThisCreateTime = DateTime.Now.ToString();
            string SqlStr         = "INSERT INTO Discuss(ItemId,UID,Detail,CreateTime) VALUES ('" + ThisItemId + "','" + ThisUID + "','" + ThisDetail + "','" + ThisCreateTime + "')";
            DA.ExecuteSql(SqlStr);
            Response.Redirect(Request.Url.ToString());
        }
        else
        {
            thisUn.Alert("你的留言不得为空", this);
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string a = "添加的参与人有:";

        foreach (DataListItem item in this.DataList1.Items)
        {
            CheckBox    CB = (CheckBox)item.FindControl("CheckBox1");
            HiddenField HF = (HiddenField)item.FindControl("HiddenField1");
            if (CB.Checked == true)
            {
                a = a + "  " + HF.Value.ToString();
                DataAccess da         = new DataAccess();
                string     UID        = HF.Value.ToString();
                string     CreateTime = DateTime.Now.ToString();
                string     sqls       = "INSERT INTO Ass_User VALUES ('" + AssId + "','" + UID + "','" + CreateTime + "')";
                da.ExecuteSql(sqls);
            }
        }

        /*for (int i = 0; i < this.GridView1.Rows.Count; i++)
         * {
         *  string Checked = ((CheckBox)GridView1.Rows[i].FindControl("cbxId")).Checked.ToString();
         *  if (Checked=="True")
         *  {
         *      DataAccess da = new DataAccess();
         *      string UID = ((HiddenField)GridView1.Rows[i].FindControl("HiddenField1")).Value.ToString();
         *      string CreateTime = DateTime.Now.ToString();
         *      string sqls = "INSERT INTO Ass_User VALUES ('" + AssId + "','" + UID + "','" + CreateTime + "')";
         *      da.ExecuteSql(sqls);
         *      a = a + GridView1.Rows[i].Cells[0].Text.Trim()+"  ";ghjjjtgfyytr4
         *  }
         * }*/
        if (a != "添加的参与人有:")
        {
            universal thisUn = new universal();
            thisUn.Alert(a, this);
        }
        Response.Redirect("~/item/ass-add3.aspx", false);
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        universal thisUn     = new universal();
        string    ThisDetail = LiuYan.Value;

        if (ThisDetail != "")
        {
            DataAccess DA = new DataAccess();
            //thisUn.Alert( DA.ConnectionTest(), this);
            string   ThisAssId = Request.QueryString["AssId"];
            string   ThisUID   = Session["UID"].ToString();
            DateTime dt        = DateTime.Now;
            //int ii = dt.GetHashCode();
            string ThisCreateTime = DateTime.Now.ToString();
            string SqlStr         = "INSERT INTO Ass_Comment(AssId,CreateUID,Detail,CreatTime) VALUES ('" + ThisAssId + "','" + ThisUID + "','" + ThisDetail + "','" + ThisCreateTime + "')";
            DA.ExecuteSql(SqlStr);
            Response.Redirect(Request.Url.ToString());   
        }
        else
        {
            thisUn.Alert("你的留言不得为空", this);
        }
    }
Exemple #11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        universal thisUn = new universal();
        string    Err    = "0";

        //正则表达式
        if ((TextBox2.Text == "") || (TextBox3.Text == ""))
        {
            Err = "5";
            thisUn.Alert("错误:未输入开始时间或结束时间", this);
        }
        else
        {
            DateTime st = DateTime.Parse(TextBox2.Text);
            DateTime et = DateTime.Parse(TextBox3.Text);
            TimeSpan ts = st.Subtract(et);

            if (ts.Days > 0)
            {
                Err = "1";
                thisUn.Alert("错误:结束时间早于开始时间", this);
            }
        }
        if (DropDownList1.SelectedValue == null)
        {
            Err = "2";
            thisUn.Alert("错误:未选择所属项目", this);
        }
        if (DropDownList2.SelectedValue == null)
        {
            Err = "3";
            thisUn.Alert("错误:未选择所属列表", this);
        }
        if (TextBox1.Text == "")
        {
            Err = "4";
            thisUn.Alert("错误:未输入任务名", this);
        }
        if (Err == "0")
        {
            DataAccess DA             = new DataAccess();
            string     Name           = TextBox1.Text;
            string     ResponsibleUID = Session["UID"].ToString();
            string     Remark         = TextArea1.Value;
            string     BelongItem     = DropDownList1.SelectedValue;
            string     BelongList     = DropDownList2.SelectedValue;
            string     CreateTime     = DateTime.Now.ToString();
            string     BeginTime      = TextBox2.Text;
            string     EndTime        = TextBox3.Text;
            string     IsImportant    = "0";
            if (CheckBox1.Checked.ToString() == "True")
            {
                IsImportant = "1";
            }
            string SqlStr = "INSERT INTO Assignment(Name,ResponsibleUID,Remark,BelongItem,BelongList,CreateTime,BeginTime,EndTime,IsImportant) VALUES ('";
            SqlStr = SqlStr + Name + "','" + ResponsibleUID + "','" + Remark + "','" + BelongItem + "','" + BelongList + "','" + CreateTime + "','" + BeginTime + "','" + EndTime + "','" + IsImportant + "')";
            DA.ExecuteSql(SqlStr);
            thisUn.Alert("创建任务成功", this);

            Response.Redirect("~/item/ass-add2.aspx", false);
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        universal un  = new universal();
        bool      Err = true;

        if (rcm.Text == "")
        {
            Err = false;
            un.Alert("日程名不得为空", this);
        }
        if (st.Text == "")
        {
            Err = false;
            un.Alert("开始时间不得为空", this);
        }
        if (et.Text == "")
        {
            Err = false;
            un.Alert("结束时间不得为空", this);
        }
        DateTime sT = DateTime.Parse(st.Text);
        DateTime eT = DateTime.Parse(et.Text);
        TimeSpan ts = sT.Subtract(eT);

        if (ts.Days > 0)
        {
            Err = false;
            un.Alert("错误:结束时间早于开始时间", this);
        }
        if (Err)
        {
            DataAccess da        = new DataAccess();
            string     Name      = rcm.Text;
            string     Remark    = xq.Text;
            string     BeginTime = st.Text;
            string     EndTime   = et.Text;
            string     Priority  = "";
            if (RadioButton1.Checked == true)
            {
                Priority = "0";
            }
            else if (RadioButton2.Checked == true)
            {
                Priority = "1";
            }
            else if (RadioButton3.Checked == true)
            {
                Priority = "2";
            }
            string AssId      = "";
            string UID        = Session["UID"].ToString();
            string CreateTime = DateTime.Now.ToString();
            string sqls       = "";
            if (RadioButtonList1.SelectedValue != null)
            {
                AssId = RadioButtonList1.SelectedValue;
                sqls  = "INSERT INTO Schedule (Name,Remark,BeginTime,EndTime,Priority,AssId,UID,CreateTime) VALUES ('" + Name + "','" + Remark + "','" + BeginTime + "','" + EndTime + "','" + Priority + "','" + AssId + "','" + UID + "','" + CreateTime + "')";
            }
            if (xq.Text == "")
            {
                sqls = "INSERT INTO Schedule (Name,BeginTime,EndTime,Priority,AssId,UID,CreateTime) VALUES  ('" + Name + "','" + BeginTime + "','" + EndTime + "','" + Priority + "','" + AssId + "','" + UID + "','" + CreateTime + "')";
                if (RadioButtonList1.SelectedValue == null)
                {
                    sqls = "INSERT INTO Schedule (Name,BeginTime,EndTime,Priority,UID,CreateTime) VALUES ('" + Name + "','" + BeginTime + "','" + EndTime + "','" + Priority + "','" + UID + "','" + CreateTime + "')";
                }
            }
            else
            {
                if (RadioButtonList1.SelectedValue == null)
                {
                    sqls = "INSERT INTO Schedule (Name,Remark,BeginTime,EndTime,Priority,UID,CreateTime) VALUES  ('" + Name + "','" + Remark + "','" + BeginTime + "','" + EndTime + "','" + Priority + "','" + UID + "','" + CreateTime + "')";
                }
            }
            da.ExecuteSql(sqls);
            alertv al = new alertv();
            Response.Write(al.gutAlertUrl("创建成功", "../item/item-list.aspx"));
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        universal thisUn = new universal();
        string    Err    = "0";

        //正则表达式
        if ((TextBox2.Text == "") || (TextBox3.Text == ""))
        {
            Err = "5";
            thisUn.Alert("错误:未输入开始时间或结束时间", this);
        }
        else
        {
            DateTime st = DateTime.Parse(TextBox2.Text);
            DateTime et = DateTime.Parse(TextBox3.Text);
            TimeSpan ts = st.Subtract(et);

            if (ts.Days > 0)
            {
                Err = "1";
                thisUn.Alert("错误:结束时间早于开始时间", this);
            }
        }
        if (DropDownList1.SelectedValue == null)
        {
            Err = "2";
            thisUn.Alert("错误:未选择所属项目", this);
        }
        if (DropDownList2.SelectedValue == null)
        {
            Err = "3";
            thisUn.Alert("错误:未选择所属列表", this);
        }
        if (TextBox1.Text == "")
        {
            Err = "4";
            thisUn.Alert("错误:未输入任务名", this);
        }
        if (Err == "0")
        {
            string Name           = TextBox1.Text;
            string ResponsibleUID = Session["UID"].ToString();
            string Remark         = TextArea1.Value;
            string BelongItem     = DropDownList1.SelectedValue;
            string BelongList     = DropDownList2.SelectedValue;
            string CreateTime     = DateTime.Now.ToString();
            string BeginTime      = TextBox2.Text;
            string EndTime        = TextBox3.Text;
            string IsImportant    = "0";
            if (CheckBox1.Checked.ToString() == "True")
            {
                IsImportant = "1";
            }
            string sqls = "INSERT INTO Assignment(Name,ResponsibleUID,Remark,BelongItem,BelongList,CreateTime,BeginTime,EndTime,IsImportant) VALUES ('";
            sqls = sqls + Name + "','" + ResponsibleUID + "','" + Remark + "','" + BelongItem + "','" + BelongList + "','" + CreateTime + "','" + BeginTime + "','" + EndTime + "','" + IsImportant + "')";
            da.ExecuteSql(sqls);
            sqls = "SELECT   TOP (1) AssId FROM  dbo.Assignment  WHERE   (ResponsibleUID = '" + Session["UID"].ToString() + "')  ORDER BY CreateTime DESC";
            DataSet ds = da.dataSet(sqls);
            AssId = ds.Tables[0].Rows[0]["AssId"].ToString();
            HiddenField1.Value = AssId;
            Panel1.Enabled     = false;
            Panel2.Visible     = true;
            thisUn.Alert("创建任务成功", this);
        }
    }