protected void Sign_Btn1(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request.QueryString["tid"]) && base.Request.QueryString["type"] == "1") { string text = base.Request.QueryString["tid"]; IList all = Work_Attend.Init().GetAll(string.Concat(new string[] { " AttendType=1 and UID=", this.Uid, " and AttendTimeID=", text, " and datediff(d,addtime,getdate())=0 " }), null); if (all.Count == 0) { Work_AttendSetInfo byId = Work_AttendSet.Init().GetById(Convert.ToInt32(text)); Work_AttendInfo work_AttendInfo = new Work_AttendInfo(); work_AttendInfo.AddTime = DateTime.Now; work_AttendInfo.UID = Convert.ToInt32(this.Uid); work_AttendInfo.DepID = Convert.ToInt32(this.DepID); work_AttendInfo.RealName = this.RealName; work_AttendInfo.DepName = this.DepName; work_AttendInfo.AttendTimeID = Convert.ToInt32(text); work_AttendInfo.StandardTimes = byId.AttendTimes; work_AttendInfo.StandardNames = byId.AttendNames; work_AttendInfo.SignTimes = DateTime.Now.TimeOfDay.ToString().Substring(0, 5); work_AttendInfo.SignDates = DateTime.Now.ToString("yyyy-MM-dd"); DateTime t = Convert.ToDateTime(byId.AttendTimes); DateTime t2 = Convert.ToDateTime(DateTime.Now.Hour + ":" + DateTime.Now.Minute); if (byId.AttendNames.Contains("上班")) { if (DateTime.Compare(t, t2) >= 0) { work_AttendInfo.SignJudge = "正常"; } else { work_AttendInfo.SignJudge = "迟到"; } } if (byId.AttendNames.Contains("下班")) { if (DateTime.Compare(t, t2) <= 0) { work_AttendInfo.SignJudge = "正常"; } else { work_AttendInfo.SignJudge = "早退"; } } work_AttendInfo.AttendType = 1; work_AttendInfo.Notes = "(" + RequestUtils.GetIP() + ") " + this.Notes1.Value; work_AttendInfo.BeginTime = DateTime.Now; work_AttendInfo.EndTime = DateTime.Now; Work_Attend.Init().Add(work_AttendInfo); base.Response.Write("<script>alert('上下班登记已添加!');window.location='WorkAttendAdd.aspx?type=1'</script>"); } } }
protected void Sign_Btn4(object sender, EventArgs e) { Work_AttendInfo work_AttendInfo = new Work_AttendInfo(); work_AttendInfo.AddTime = DateTime.Now; work_AttendInfo.UID = Convert.ToInt32(this.Uid); work_AttendInfo.DepID = Convert.ToInt32(this.DepID); work_AttendInfo.RealName = this.RealName; work_AttendInfo.DepName = this.DepName; work_AttendInfo.AttendTimeID = 0; work_AttendInfo.StandardTimes = ""; work_AttendInfo.StandardNames = ""; work_AttendInfo.SignTimes = ""; work_AttendInfo.SignDates = ""; work_AttendInfo.SignJudge = ""; work_AttendInfo.AttendType = 4; work_AttendInfo.TravelAddress = this.TravelAddress4.Value; work_AttendInfo.Notes = "(" + RequestUtils.GetIP() + ") " + this.Notes4.Value; work_AttendInfo.BeginTime = Convert.ToDateTime(base.Request.Form["BeginTime4"]); work_AttendInfo.EndTime = Convert.ToDateTime(base.Request.Form["EndTime4"]); work_AttendInfo.B1 = base.Request.Form["B1_4"]; work_AttendInfo.B2 = base.Request.Form["B2_4"]; work_AttendInfo.E1 = base.Request.Form["E1_4"]; work_AttendInfo.E2 = base.Request.Form["E2_4"]; Work_Attend.Init().Add(work_AttendInfo); base.Response.Write("<script>alert('出差登记已添加!');window.location='WorkAttendAdd.aspx?type=4'</script>"); }
//protected HtmlHead Head1; //protected HtmlForm form1; //protected Panel search1; //protected Panel search2; //protected Panel panLogin; //protected Button search_bt; //protected Button dc_bt; //protected DropDownList AttendType; //protected HtmlInputText BeginTime_S; //protected HtmlInputText EndTime_S; //protected HtmlInputText keyword; //protected Panel list1; //protected Repeater rpt1; //protected HtmlGenericControl num1; //protected Page Page1; //protected Panel list2; //protected Repeater rpt2; //protected HtmlGenericControl num2; //protected Page Page2; //protected Panel list3; //protected Repeater rpt3; //protected HtmlGenericControl num3; //protected Page Page3; //protected Panel list4; //protected Repeater rpt4; //protected HtmlGenericControl num4; //protected Page Page4; //protected Panel del5; //protected HtmlInputText BeginTime_D; //protected HtmlInputText EndTime_D; //protected CheckBoxList DeleteType; //protected HtmlInputText delarea; //protected Button del_bt; protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { if (!string.IsNullOrEmpty(base.Request.QueryString["type"])) { this.Show(base.Request.QueryString["type"]); } if (!string.IsNullOrEmpty(base.Request.QueryString["del"])) { this.del5.Visible = true; this.search1.Visible = false; this.search2.Visible = false; } if (!string.IsNullOrEmpty(base.Request.QueryString["delete"]) && !string.IsNullOrEmpty(base.Request.QueryString["wid"]) && !string.IsNullOrEmpty(base.Request.QueryString["type"])) { int id = Convert.ToInt32(base.Request.QueryString["wid"]); Work_Attend.Init().Delete(id); base.Response.Redirect("WorkList.aspx?type=" + base.Request.QueryString["type"]); } } }
private void Show(string wid) { Work_AttendInfo byId = Work_Attend.Init().GetById(Convert.ToInt32(wid)); this.WorkNote.Text = byId.Notes; this.WorkPeople.Text = byId.RealName + "(" + byId.DepName + ")"; this.WorkDate.Text = Utils.ConvertDate4(byId.AddTime); switch (byId.AttendType) { case 1: this.WorkType.InnerText = "上下班考勤"; this.WorkInfo.Text = string.Concat(new string[] { byId.StandardNames, ": ", byId.SignTimes, " (", byId.SignJudge, " ", byId.StandardTimes, ")" }); break; case 2: this.WorkType.InnerText = "外出"; this.WorkInfo.Text = string.Concat(new string[] { Utils.ConvertDate0(byId.BeginTime), " ", byId.B1, ":", byId.B2, " - ", Utils.ConvertDate0(byId.EndTime), " ", byId.E1, ":", byId.E2 }); break; case 3: this.WorkType.InnerText = "请假"; this.WorkInfo.Text = string.Concat(new string[] { Utils.ConvertDate0(byId.BeginTime), " ", byId.B1, ":", byId.B2, " - ", Utils.ConvertDate0(byId.EndTime), " ", byId.E1, ":", byId.E2 }); break; case 4: this.WorkType.InnerText = "出差"; this.WorkInfo.Text = string.Concat(new string[] { Utils.ConvertDate0(byId.BeginTime), " ", byId.B1, ":", byId.B2, " - ", Utils.ConvertDate0(byId.EndTime), " ", byId.E1, ":", byId.E2 }); break; } }