protected void btleave_Click(object sender, EventArgs e) { workDBDataContext db = new workDBDataContext(); jiaban myjb = new jiaban(); if (Session["name"] == null) { Page.ClientScript.RegisterStartupScript(GetType(), "", "alert('登录已过期');location.href='SBSLogin.aspx';", true); return; } myjb.name = Session["name"].ToString(); myjb.starttime = DateTime.Parse(this.txtFrom.Text); myjb.startshift = this.drp_start.Text; myjb.startweek = convertdate(Convert.ToDateTime(this.txtFrom.Text).DayOfWeek.ToString()); myjb.endtime = DateTime.Parse(this.txtTo.Text); myjb.endshift = this.drp_end.Text; myjb.endweek = convertdate(Convert.ToDateTime(this.txtTo.Text).DayOfWeek.ToString()); myjb.content = this.tb_leave.Text; myjb.approve = 4; if (myjb.starttime > myjb.endtime) { Page.ClientScript.RegisterStartupScript(GetType(), "", "alert('开始日期不得晚于结束日期');location.href='CommitWork.aspx';", true); return; } else if (myjb.starttime == myjb.endtime && myjb.startshift == "下午" && myjb.endshift == "上午") { Page.ClientScript.RegisterStartupScript(GetType(), "", "alert('开始日期不得晚于结束日期');location.href='CommitLeave.aspx';", true); return; } db.jiaban.InsertOnSubmit(myjb); db.SubmitChanges(); Page.ClientScript.RegisterStartupScript(GetType(), "", "alert('加班申报成功!');location.href='staff.aspx';", true); }
partial void Deletejiaban(jiaban instance);
partial void Updatejiaban(jiaban instance);
partial void Insertjiaban(jiaban instance);