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(); } }
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 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(); }
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>"); } } } }
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 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 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以下的文件."; } }
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 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>"); } }
protected void Button1_Click(object sender, EventArgs e) { string sql = "insert into FlowType (Name) values('" + this.TextBox1.Text + "')"; OperateDB.ExecuteNonQuery(sql); 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(); }
protected void Button1_Command(object sender, CommandEventArgs e) { int Sid = Convert.ToInt32(e.CommandArgument); string sql = "delete from AddressList where sid=" + Sid + ""; OperateDB.ExecuteNonQuery(sql); Response.Write("<script>alert('删除成功!!')</script>"); Bind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sql = "delete from Appurtenance where 1=1"; OperateDB.ExecuteNonQuery(sql); } Bind(); }
protected void Button1_Command(object sender, CommandEventArgs e) { int PlanId = Convert.ToInt32(e.CommandArgument); string sql = "Delete from [Plan] where Planid=" + PlanId + ""; OperateDB.ExecuteNonQuery(sql); Response.Write("<script>alert('删除成功!')</script>"); Bind(); }
protected void Button1_Command(object sender, CommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); string sql = "delete from Calendar where CalendarID=" + id + ""; if (OperateDB.ExecuteNonQuery(sql) > 0) { Bind(); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string strid = this.GridView1.DataKeys[e.RowIndex].Value.ToString(); string sql = "delete from FlowStepPerson where StepID=" + strid; OperateDB.ExecuteNonQuery(sql); string sql1 = "delete from FlowStep where ID=" + strid; if (OperateDB.ExecuteNonQuery(sql1) != 1) { Response.Write("<script language=javascrip>alert('删除成功!')</script>"); } Bind(); }
protected void btnpub_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textcontent.Value)) { } else { int id = Convert.ToInt32(Request["NewsID"].ToString()); string userid = getuserid(); string sql = "insert NewsRemark values('" + this.textcontent.Value.Trim() + "'," + userid + ",'" + id + "','" + DateTime.Now + "')"; OperateDB.ExecuteNonQuery(sql); this.textcontent.Value = ""; Bind(); } }
public string tb_ServerClick1(string id) { if (id == null) { return("asd"); } else { int sid = Convert.ToInt32(id); string status = "已查看"; string sql = "update Email set Status='" + status + "' where sid=" + id + " "; OperateDB.ExecuteNonQuery(sql); return("asdasd"); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int Appurtenanceid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString()); string url = Server.MapPath("~") + "\\upfiles\\" + src; if (File.Exists(url)) { File.Delete(url); } string sql = "delete from Appurtenance where Appurtenanceid=" + Appurtenanceid + ""; OperateDB.ExecuteNonQuery(sql); this.Label1.Text = "删除成功"; Bind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int strid = Convert.ToInt32(this.GridView1.DataKeys[e.RowIndex]["ID"].ToString()); string sql = "delete from FlowType where ID=" + strid; if (OperateDB.ExecuteNonQuery(sql) > 0) { Response.Write("<script language=javascript>alert('删除成功!')</script>"); } else { Response.Write("<script language=javascript>alert('删除失败!')</script>"); } Bind(); }
protected void Button1_Click(object sender, EventArgs e) { string sql = "insert [Plan] values('" + Convert.ToDateTime(this.calendar1.Text) + "','" + content.Text + "','" + titel.Text + "','" + Session["UserName"].ToString() + "')"; if (OperateDB.ExecuteNonQuery(sql) == 1) { titel.Text = ""; content.Text = ""; Response.Redirect("Plan.aspx"); } else { Response.Write("<script>alert('添加失败')</script>"); } }
protected void Button1_Command(object sender, CommandEventArgs e) { try { int id = Convert.ToInt32(e.CommandArgument); string sql = "delete from grouping where groupingid=" + id + ""; OperateDB.ExecuteNonQuery(sql); Response.Write("<script>alert('删除成功!')</script>"); Bind(); } catch (Exception ex) { Response.Write("<script>alert('对不起,先要删除此组联系人!!')</script>"); } }
protected void Unnamed1_Click(object sender, EventArgs e) { DateTime shang = Convert.ToDateTime(this.shang.Value); DateTime xia = Convert.ToDateTime(this.xia.Value); string sql = "update CheckTime set shangtime='" + shang + "',xiatime='" + xia + "'"; if (OperateDB.ExecuteNonQuery(sql) > 0) { Response.Write("<script>alert('修改成功')</script>"); this.shang.Value = ""; this.xia.Value = ""; } else { Response.Write("<script>alert('修改失败')</script>"); } }
public string qwe(string CalendarID, string title, string time, string content) { if (CalendarID == null || title == null || title == null || content == null) { return("asd"); } else { string sql = "update Calendar set Motif='" + title.Trim() + "',Content='" + content.Trim() + "',addtime='" + time.Trim() + "' where CalendarID='" + CalendarID + "'"; OperateDB.ExecuteNonQuery(sql); this.title.InnerText = title; this.time.InnerText = time; this.content.InnerText = content; this.CalendarID.InnerText = CalendarID; return("asd"); } }
protected void Button5_Click(object sender, EventArgs e) { int stepid = Convert.ToInt32(Request.QueryString["stepid"]); for (int i = 0; i < this.ListBox2.Items.Count; i++) { string strSql = "select * from FlowStepPerson where UserID=" + ListBox2.Items[i].Value + " and StepID=" + stepid; if (OperateDB.ExecuteDataSet(strSql).Tables[0].Rows.Count < 1) { string sql = "insert into FlowStepPerson values(" + stepid + "," + ListBox2.Items[i].Value + ",0,0)"; if (OperateDB.ExecuteNonQuery(sql) > 0) { Response.Write("<script >window.location.href='FlowStep.aspx?id=" + Request.QueryString["flowid"].ToString() + "'</script>"); } } } }
protected void Button1_Click(object sender, EventArgs e) { 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(Request.QueryString["id"]); string strSql = "insert into FlowStep values(" + action + "," + join + ",'" + des + "'," + num + "," + flowid + "," + end + ")"; if (OperateDB.ExecuteNonQuery(strSql) != 1) { Response.Write("<script language=javascript>alert('保存失败!')</script>"); } Bind(); }
public string qwe(string planID, string topic, string addtime, string content) { if (addtime == null || content == null || topic == null) { return("输入不完整"); } else { try { if (string.IsNullOrEmpty(planID) && addtime != null && content != null && topic != null) { string sql = "insert [Plan] values('" + Convert.ToDateTime(addtime) + "','" + content + "','" + topic + "','" + Session["UserName"].ToString() + "')"; if (OperateDB.ExecuteNonQuery(sql) == 1) { Response.Write("<script>alert('!')</script>"); this.topic.InnerText = ""; this.addtime.InnerText = ""; this.content.InnerText = ""; this.planID.InnerText = ""; } return("添加成功"); } else { string sql = "update [Plan] set topic='" + topic.Trim() + "',Content='" + content.Trim() + "',Addtime='" + addtime.Trim() + "' where PlanID='" + planID + "'"; OperateDB.ExecuteNonQuery(sql); this.topic.InnerText = topic; this.addtime.InnerText = addtime; this.content.InnerText = content; this.planID.InnerText = planID; return("更新成功"); } } catch (Exception) { Response.Write("<script>输入正确格式</script>"); return("格式不正确"); } } }
protected void Button1_Click(object sender, EventArgs e) { string title = this.title.InnerHtml; if (this.title.InnerText.Trim() == "" || this.content.InnerText.Trim() == "" || this.time.InnerText.Trim() == "") { Response.Write("<script>alert('请输入详细信息!!')</script>"); } else { string sql = "update Calendar set Motif='" + this.title.InnerText.Trim() + "',Content='" + this.content.InnerText.Trim() + "',addtime='" + this.time.InnerText.Trim() + "' where CalendarID='" + Request["id"].ToString() + "'"; if (OperateDB.ExecuteNonQuery(sql) > 0) { Response.Write("<script>alert('修改成功!!')</script>"); } else { Response.Write("<script>alert('出错啦!!')</script>"); } } }
protected void Button1_Click(object sender, EventArgs e) { if (Request["Sid"] != null) { int sid = Convert.ToInt32(Request["Sid"].ToString()); string sql = "update addresslist set Marry='" + DropDownList2.SelectedItem.Text + "',Sex='" + DropDownList1.SelectedItem.Text + "', HomePost='" + TextBox2.Text + "',Mobile='" + TextBox4.Text + "',QQ='" + TextBox3.Text + "',Intro='" + TextBox5 + "'"; try { if (OperateDB.ExecuteNonQuery(sql) > 0) { Response.Write("<script>alert('修改成功!');window.location.href='ContactsList.aspx';</script>"); } else { Response.Write("<script>alert('修改失败!');</script>"); } } catch (Exception ex) { throw (ex); } } else { if (TextBox1.Text.Trim() == "") { Response.Write("<script>alert('请添加联系人姓名!')</script>"); } else { string sql = "insert addresslist values('" + TextBox1.Text + "','" + DropDownList1.SelectedItem.Text + "','" + DropDownList2.SelectedItem.Text + "','" + null + "','" + DropDownList3.SelectedItem.Text + "'," + "'" + null + "','" + null + "','" + null + "','" + null + "','" + null + "','" + null + "','" + null + "'," + "'" + null + "','" + null + "','" + null + "','" + null + "','" + null + "','" + null + "','" + TextBox2.Text + "'," + "'" + null + "','" + TextBox4.Text + "','" + TextBox3.Text + "','" + null + "','" + TextBox5.Text + "','" + Session["UserName"].ToString() + "','" + DateTime.Now.ToString() + "'," + Convert.ToInt32(DropDownList3.SelectedItem.Value.ToString()) + ")"; OperateDB.ExecuteNonQuery(sql); Response.Write("<script>alert('添加成功!!');window.location.href='ContactsList.aspx';</script>"); } } }