public string Name(string y) { int NewsID = Convert.ToInt32(Request["NewsID"].ToString()); string sql = "select Name from Employee where username='******'"; return(OperateDB.getExecuteScalar(sql)); }
public void Bind() { DataSet ds = new DataSet(); string strsql = "select * from LoginInfo ORDER BY loginid DESC"; ds = OperateDB.ExecuteDataSet(strsql); DataTable dt = new DataTable(); dt = ds.Tables[0]; DataColumn dc = dt.Columns.Add("number", System.Type.GetType("System.String")); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["number"] = (i + 1).ToString(); } DataView dv = ds.Tables[0].DefaultView; PagedDataSource pds = new PagedDataSource(); AspNetPager1.RecordCount = dv.Count; pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; this.GridView1.DataSource = pds; this.GridView1.DataBind(); }
protected void Button3_Click(object sender, EventArgs e) { if (Request.Form["ctl00$ContentPlaceHolder1$calendar1"] == "" || Request.Form["ctl00$ContentPlaceHolder1$calendar2"] == "") { Bind(getsql()); } else { DateTime FD = Convert.ToDateTime(Request.Form["ctl00$ContentPlaceHolder1$calendar1"]); DateTime TD = Convert.ToDateTime(Request.Form["ctl00$ContentPlaceHolder1$calendar2"]); if (this.DropDownList1.SelectedIndex == 0 || DropDownList1.SelectedIndex == 1) { this.DataList2.DataSource = OperateDB.ExecuteDataSet(getsql(FD, TD, true)); this.DataList2.DataBind(); DataList2.Visible = true; DataList1.Visible = false; } else if (DropDownList1.SelectedIndex == 2) { this.DataList1.DataSource = OperateDB.ExecuteDataSet(getsql(FD, TD, false)); this.DataList1.DataBind(); DataList2.Visible = false; DataList1.Visible = true; } } }
protected void Button1_Click(object sender, EventArgs e) { string sql = "insert into FlowType (Name) values('" + this.TextBox1.Text + "')"; OperateDB.ExecuteNonQuery(sql); Bind(); }
protected void Button1_Click(object sender, EventArgs e) { string sql = "select * from Employee"; if (DropDownList1.SelectedItem.Text == "全部" && TextBox1.Text == "") { return; } else { if (DropDownList1.SelectedItem.Text != "全部" && TextBox1.Text == "") { sql = "select * from Employee where branch='" + DropDownList1.SelectedItem.Text + "' "; } if (DropDownList1.SelectedItem.Text == "全部" && TextBox1.Text != "") { sql = "select * from Employee where name like('%" + this.TextBox1.Text + "%')"; } if (DropDownList1.SelectedItem.Text != "全部" && TextBox1.Text != "") { sql = "select * from Employee where branch='" + DropDownList1.SelectedItem.Text + "' and name like('%" + this.TextBox1.Text + "%') "; } dt1.DataSource = OperateDB.ExecuteDataSet(sql); dt1.DataBind(); } }
protected void comeback_Click(object sender, EventArgs e) { string strsql = "select OutRegisterid from OutRegister where ReturnTime='未归' and username='******'"; id = Convert.ToInt32(OperateDB.getExecuteScalar(strsql)); if (id == 0) { Response.Write("<script>alert('你还没有外出!')</script>"); } else { DateTime dt = DateTime.Now; string sql = "update OutRegister set returntime='" + dt.ToString() + "' where OutRegisterid='" + id + "'"; if (OperateDB.ExecuteNonQuery(sql) > 0) { Response.Write("<script>alert('回来登记成功!')</script>"); } else { Response.Write("<script>alert('回来登记失败!')</script>"); } } Bind(); }
private void Bind() { string sql = "select News.NewsID,News.title,NewsType.Type,News.pubdate,News.content from News,NewsType where News.TypeId=NewsType.NTID "; dt1.DataSource = OperateDB.ExecuteDataSet(sql); dt1.DataBind(); }
protected void ok_Click(object sender, EventArgs e) { string sql = "select ShangTime from Checktime "; DateTime shang = Convert.ToDateTime(OperateDB.getExecuteScalar(sql)); DateTime time = Convert.ToDateTime(DateTime.Now.ToString()); TimeSpan d = shang.TimeOfDay; TimeSpan dd = time.TimeOfDay; if (d > dd) { int i = 1; int b = 0; string Da = DateTime.Now.ToLongDateString(); string state = "考勤成功"; string id = Session["UserName"].ToString(); string Content = this.TextArea1.Value; Response.Write("<script>alert('考勤成功!')</script>"); string sql1 = "insert into [Check] values('" + time.ToString() + "',null,'" + Da + "','" + id + "','" + state + "',null,'" + Content + "',null," + i + "," + b + ")"; OperateDB.ExecuteNonQuery(sql1); Bind(); } else { int i = 1; int b = 0; string Da = DateTime.Now.ToLongDateString(); string id = Session["UserName"].ToString(); string state = "迟到"; string Content = this.TextArea1.Value; DateTime Time1 = DateTime.Now; string sql2 = "insert into [Check] values('" + Time1.ToString() + "',null,'" + Da + "','" + id + "','" + state + "',null,'" + Content + "',null," + i + "," + b + ")"; OperateDB.ExecuteNonQuery(sql2); Bind(); } }
protected void ok1_Click(object sender, EventArgs e) { string sql = "select xiaTime from Checktime "; DateTime xia = Convert.ToDateTime(OperateDB.getExecuteScalar(sql).ToString()); DateTime time = Convert.ToDateTime(DateTime.Now.ToString()); TimeSpan d = xia.TimeOfDay; TimeSpan dd = time.TimeOfDay; if (d > dd) { DateTime dt = DateTime.Now; string Da = DateTime.Now.ToLongDateString(); string y = "早退"; string Whys = this.TextArea1.Value.Trim(); int s = 1; int x = 1; string sql1 = "update [Check] set offdutyTime='" + dt.ToString() + "',offdutystate='" + y + "',offwhys='" + Whys + "',shang=" + s + ",xia=" + x + " where username='******' and CheckDate='" + Da + "'"; OperateDB.ExecuteNonQuery(sql1); Bind(); } else { DateTime dt = DateTime.Now; string Da = DateTime.Now.ToLongDateString(); string y = "成功考勤"; string Whys = this.TextArea1.Value.Trim(); int s = 1; int x = 1; string sql1 = "update [Check] set offdutyTime='" + dt.ToString() + "',offdutystate='" + y + "',offwhys='" + Whys + "',shang=" + s + ",xia=" + x + " where username='******' and CheckDate='" + Da + "'"; OperateDB.ExecuteNonQuery(sql1); Bind(); } }
private void Bind() { string sql = "select * from suggest order by suggestid desc"; Repeater1.DataSource = OperateDB.paged(sql, AspNetPager1); Repeater1.DataBind(); }
protected void btnpub_Click(object sender, EventArgs e) { string name; DateTime dt = DateTime.Now; if (this.textcontent.Value == "") { Response.Write("<script>alert('请输入内容!')</script>"); } else { if (this.txtname.Text == "") { name = "匿名"; } else { name = this.txtname.Text; } string sql = "insert suggest values('" + dt + "','" + name + "','" + this.textcontent.Value + "')"; OperateDB.ExecuteNonQuery(sql); this.textcontent.Value = ""; Bind(); } }
protected void goout_Click(object sender, EventArgs e) { string strsql = "select Evectionid from Evection where rtime='未回'"; id = Convert.ToInt32(OperateDB.getExecuteScalar(strsql)); string add = this.add.Text; if (string.IsNullOrEmpty(add)) { Response.Write("<script>alert('请输入地点')</script>"); } else { if (id != 0) { Response.Write("<script>alert('还没有回来登记!不能登记出差')</script>"); } else { DateTime Da = DateTime.Now; string sql = "insert into Evection values('" + add + "','" + Da + "','未回','" + this.TextArea1.Value + "','" + Session["UserName"].ToString() + "')"; id = Convert.ToInt32(OperateDB.getExecuteScalar(sql)); Response.Write("<script>alert('出差登记成功!')</script>"); } } Bind(); }
public string useram() { NewsID = Convert.ToInt32(Request["NewsID"].ToString()); string sql = "select Name from Employee where Employeeid=(select UserID from News where NewsID=" + NewsID + ")"; return(OperateDB.getExecuteScalar(sql)); }
private string getuserid() { string id = ""; string sql = "select Employeeid from Employee where username='******'"; return(OperateDB.getExecuteScalar(sql)); }
public string getAction(string id) { string sql = "select Name from FlowAction where ID=" + id; string action = OperateDB.getExecuteScalar(sql); return(action); }
protected void btnsave_Click(object sender, EventArgs e) { if (Request.Form["ctl00$ContentPlaceHolder1$addtime"].Trim() == "" || this.Motif.Text.Trim() == "" || this.textcontent.Text.Trim() == "") { this.Motif.Text = ""; this.textcontent.Text = ""; addtime.Text = ""; return; } else { DateTime starttime = Convert.ToDateTime(Request.Form["ctl00$ContentPlaceHolder1$addtime"]); string UserName = Session["UserName"].ToString(); log sl = new log(); string sql = "select id from UserInfo where UserName='******'"; int ID = Convert.ToInt32(OperateDB.getExecuteScalar(sql)); string Motif = this.Motif.Text.Trim(); string Content = this.textcontent.Text.Trim(); string AddTime = addtime.Text.Trim(); sl.InsertCalendar(ID, Motif, Content, AddTime); Response.Write("<script>alert('添加成功!');</script>"); Bind(); this.Motif.Text = ""; this.textcontent.Text = ""; addtime.Text = ""; } }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox2.Text.Trim() == TextBox3.Text.Trim() && TextBox2.Text.Trim() != "" && TextBox3.Text.Trim() != "") { if (this.TextBox1.Text.Trim() == "") { this.div1.Attributes.Add("class", "has-error input-group mar"); Response.Write("<script>alert('请填写正确资料')</script>"); } else { string sql = "update userinfo set Password='******' where password='******' and username='******'"; if (OperateDB.ExecuteNonQuery(sql) > 0) { Response.Write("<script>alert('修改成功!');window.location.href='../Main.aspx';</script>"); } else { this.div1.Attributes.Add("class", "has-error input-group mar"); Response.Write("<script>alert('请填写正确资料')</script>"); } } } else { this.div2.Attributes.Add("class", "has-error input-group mar"); this.div3.Attributes.Add("class", "has-error input-group mar"); Response.Write("<script>alert('请填写正确资料');</script>"); } }
public string SelectName() { string sql = "select Name from Employee where UserName='******'"; string Name = OperateDB.getExecuteScalar(sql); return(Name); }
public void Bind() { string sql = "select * from grouping where username='******'"; dt1.DataSource = OperateDB.ExecuteDataSet(sql); dt1.DataBind(); }
public void Bind() { string sql = "select * from Employee"; dt1.DataSource = OperateDB.ExecuteDataSet(sql); dt1.DataBind(); }
public void Bind() { string sql = "select * from FlowType"; this.GridView1.DataSource = OperateDB.ExecuteDataSet(sql).Tables[0]; this.GridView1.DataBind(); }
protected void Button3_Click(object sender, EventArgs e) { try { string action = this.drpAction.SelectedItem.Value.ToString();; int num = Convert.ToInt32(this.txtNum.Text); string join = this.drpJoin.SelectedItem.Value.ToString(); string end = this.drpEnd.SelectedItem.Value.ToString(); string des = this.txtDes.Text; int flowid = Convert.ToInt32(this.GridView1.DataKeys[this.GridView1.SelectedIndex][0].ToString()); string strSql = "update FlowStep set ActionID=" + action + ",IsJoin=" + join + ",Des='" + des + "',Num=" + num + ",IsEnd=" + end + " where ID=" + flowid; if (OperateDB.ExecuteNonQuery(strSql) > 0) { } else { Response.Write("<script>alert('保存失败!');</script>"); } Bind(); } catch (Exception) { Response.Write("<script>alert('登录超时,请重新登录!');window.location.href='../Login.aspx'</script>"); } }
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>"); } } } }
public string qwe(string NotepaperID, string title, string addtime, string message) { if (addtime == null || message == null || title == null) { return("ad"); } else { if (string.IsNullOrEmpty(NotepaperID) && addtime != null && message != null && title != null) { string sql = "insert Notepaper values('" + message + "','" + DateTime.Now + "','" + Session["UserName"].ToString() + "','" + title + "')"; if (OperateDB.ExecuteNonQuery(sql) == 1) { Response.Write("<script>alert('添加成功!');</script>"); this.title.InnerText = ""; this.addtime.InnerText = ""; this.message.InnerText = ""; this.NotepaperID.InnerText = ""; } return("asd"); } else { string sql = "update Notepaper set title='" + title.Trim() + "',message='" + message.Trim() + "',Addtime='" + addtime.Trim() + "' where NotepaperID='" + NotepaperID + "'"; OperateDB.ExecuteNonQuery(sql); this.title.InnerText = title; this.addtime.InnerText = addtime; this.message.InnerText = message; this.NotepaperID.InnerText = NotepaperID; return("asd"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]); con.Open(); string sql = "select * from Branch"; SqlCommand com = new SqlCommand(sql, con); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { DropDownList1.Items.Add(new ListItem(dr["Branch"].ToString(), dr["Dutyid"].ToString())); } DropDownList1.Items.Insert(0, "选择部门...."); con.Close(); string sql1 = "select * from Employee"; ListBox1.DataSource = OperateDB.ExecuteDataSet(sql1); ListBox1.DataTextField = "Name"; ListBox1.DataValueField = "username"; ListBox1.DataBind(); } }
private void Bind() { string sql1 = "select * from Appurtenance "; this.GridView1.DataSource = OperateDB.ExecuteDataSet(sql1); this.GridView1.DataBind(); }
protected void bnUpload_ServerClick(object sender, EventArgs e) { try { if (FileUpload1.PostedFile.ContentLength == 0) { src = ""; } else { string strFilePath = FileUpload1.PostedFile.FileName; FileInfo fl = new FileInfo(strFilePath); string Ext = fl.Name; //string i = fl.Name; src = Ext; string ServerPath = Server.MapPath("~"); string strSeraPath = ServerPath + "\\upfiles\\" + src; FileUpload1.PostedFile.SaveAs(strSeraPath); this.Panel1.Visible = true; string sql = "insert Appurtenance values('" + Session["UserName"] + "','" + src + "')"; OperateDB.ExecuteNonQuery(sql); this.Panel1.Visible = true; Bind(); } } catch (Exception ex) { this.Label1.Text = "只能上传5M以下的文件."; } }
private void Bind() { string sql = "select * from [Plan] where username='******'"; this.dtlst.DataSource = OperateDB.ExecuteDataSet(sql); this.dtlst.DataBind(); }
protected void comeback_Click(object sender, EventArgs e) { string strsql = "select LeaveID from Leave where retrue='未回'"; id = Convert.ToInt32(OperateDB.getExecuteScalar(strsql)); if (id == 0) { Response.Write("<script>alert('你还没有请假!')</script>"); } else { DateTime dt = DateTime.Now; string sql = "update Leave set retrue='" + dt + "' where LeaveID='" + id + "'"; if (OperateDB.ExecuteNonQuery(sql) > 0) { Response.Write("<script>alert('回来登记成功!')</script>"); } else { Response.Write("<script>alert('回来登记失败!')</script>"); } } Bind(); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { string sql = "update FlowType set Name='" + ((TextBox)(GridView1.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString() + "' where ID=" + this.GridView1.DataKeys[e.RowIndex].Value; OperateDB.ExecuteNonQuery(sql); GridView1.EditIndex = -1; Bind(); }