protected void Button_qingjia_Click(object sender, EventArgs e) { using (MySqlDBContext db = new MySqlDBContext()) { //删除所有请假数据 重新全部添加 db.Database.ExecuteSqlCommand("TRUNCATE TABLE qingjias"); var userList = db.user.Where(x => x.getdata.Value == 1).Select(x => x.user_id).ToList(); foreach (var item in userList) { List <string> ids = GetIdList(item);//获取具体用户的所有审批id foreach (var id in ids) { var data = dd.GetProcessInstance(id); var operation_records = data.process_instance.operation_records.Count; //审批通过 if (data.process_instance.result == "agree") { var qjData = JsonHelper.DeserializeJsonToObject <dynamic>(Convert.ToString(data.process_instance.form_component_values[0].value)); string startTime = Convert.ToString(qjData[0]); if (startTime.Contains("上午")) { startTime = startTime.Replace("上午", " 08:30:00"); } else if (startTime.Contains("下午")) { startTime = startTime.Replace("下午", " 17:00:00"); } string endTime = Convert.ToString(qjData[1]); if (endTime.Contains("上午")) { endTime = endTime.Replace("上午", " 08:30:00"); } else if (endTime.Contains("下午")) { endTime = endTime.Replace("下午", " 17:00:00"); } qingjia qj = new qingjia { user_id = item, 开始时间 = startTime, 结束时间 = endTime, 请假类型 = Convert.ToString(qjData[4]) }; db.qingjia.Add(qj); } } } if (db.SaveChanges() > 0) { Response.Write("<script>if(confirm('请假数据更新完成')){window.location='/xuanze.aspx'} else{window.location='/xuanze.aspx'}</script>"); } else { var redirect = "<script>if(confirm('暂时没有更新项,是否重新更新 ')){window.location='/xuanze.aspx'} else " + "{window.location='/shujugengxin.aspx'}</script>"; Response.Write(redirect); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["number"] == null) { Response.Write("<script>alert('登录时间过期,请重新登录');window.location='../login.aspx';</script>"); return; } Calendar1.Visible = false; z_time.Text = DateTime.Now.ToString("yyyy-MM-dd"); Calendar2.Visible = false; r_time.Text = DateTime.Now.ToString("yyyy-MM-dd"); Calendar3.Visible = false; startdate.Text = DateTime.Now.ToString("yyyy-MM-dd"); Calendar4.Visible = false; enddate.Text = DateTime.Now.ToString("yyyy-MM-dd"); string fun = Request.QueryString["operfun"]; string operid = Request.QueryString["operid"]; string operleibie = null; String sql10 = "SELECT s_leibie FROM [ShenQingShenBao] where id='" + operid + "'"; // System.Diagnostics.Debug.Assert(false, sql10);//打印调试信息 DataTable dt_leibie = SqlHelper.ExecuteDataTable(sql10); int i_all = dt_leibie.Rows.Count; if (i_all > 0) { operleibie = dt_leibie.Rows[0][0].ToString(); } if (fun == "edit" && operleibie == "周计划") { string sql = "select * from [ZhouJiHua] where id='" + operid + "'"; // System.Diagnostics.Debug.Assert(false, sql); using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql)) { if (dr.Read()) //读入需要修改的内容 { person1 = new ZhouJiHua(); _ID.Text = dr["id"].ToString(); z_time.Text = dr["z_time"].ToString(); z_jihua.Text = dr["z_jihua"].ToString(); z_mubiao.Text = dr["z_mubiao"].ToString(); z_zhanbi.Text = dr["z_zhanbi"].ToString(); z_shishiqingkuang.Text = dr["z_shishiqingkuang"].ToString(); z_jieguo.Text = dr["z_jieguo"].ToString(); } } } if (fun == "edit" && operleibie == "日计划") { string sql = "select * from [RiJiHua] where id='" + operid + "'"; // System.Diagnostics.Debug.Assert(false, sql); using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql)) { if (dr.Read()) //读入需要修改的内容 { person2 = new RiJiHua(); _ID.Text = dr["id"].ToString(); r_time.Text = dr["r_time"].ToString(); r_jihua.Text = dr["r_jihua"].ToString(); r_mubiao.Text = dr["r_mubiao"].ToString(); r_gongshi.Text = dr["r_gongshi"].ToString(); r_neirong.Text = dr["r_neirong"].ToString(); r_jieguo.Text = dr["r_jieguo"].ToString(); } } } if (fun == "edit" && operleibie == "请假") { string sql = "select * from [qingjia] where id='" + operid + "'"; // System.Diagnostics.Debug.Assert(false, sql); using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql)) { if (dr.Read()) //读入需要修改的内容 { person3 = new qingjia(); _ID.Text = dr["Q_ID"].ToString(); ddl_shixiang.Text = dr["q_shixiang"].ToString(); string str2 = dr.GetString(dr.GetOrdinal("q_startdate")); string[] sArray = str2.Split(' '); startdate.Text = sArray[0]; string[] time1 = sArray[1].Split(':'); time11_d1.Text = time1[0]; time11_d2.Text = time1[1]; string str1 = dr.GetString(dr.GetOrdinal("q_enddate")); string[] sArray1 = str1.Split(' '); enddate.Text = sArray1[0]; string[] time2 = sArray1[1].Split(':'); time12_d1.Text = time2[0]; time12_d2.Text = time2[1]; thing.Text = dr["q_things"].ToString(); tianall.Text = dr["q_all"].ToString(); this.Label2.Text = dr["ImageUrl"].ToString(); } } } GridViewDataBind(); for (int i = 0; i <= 23; i++) { if (i < 10) { time11_d1.Items.Add('0' + i.ToString()); time12_d1.Items.Add('0' + i.ToString()); } else { time11_d1.Items.Add(i.ToString()); time12_d1.Items.Add(i.ToString()); } } for (int i = 0; i < 60; i++) { if (i < 10) { time11_d2.Items.Add('0' + i.ToString()); time12_d2.Items.Add('0' + i.ToString()); } else { time11_d2.Items.Add(i.ToString()); time12_d2.Items.Add(i.ToString()); } } time11_d1.Text = "09"; time12_d1.Text = "18"; } gvShow.Style.Add("table-layout", "fixed"); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { for (int i = 0; i <= 23; i++) { if (i < 10) { time11_d1.Items.Add('0' + i.ToString()); time12_d1.Items.Add('0' + i.ToString()); } else { time11_d1.Items.Add(i.ToString()); time12_d1.Items.Add(i.ToString()); } } for (int i = 0; i < 60; i++) { if (i < 10) { time11_d2.Items.Add('0' + i.ToString()); time12_d2.Items.Add('0' + i.ToString()); } else { time11_d2.Items.Add(i.ToString()); time12_d2.Items.Add(i.ToString()); } } string fun = Request.QueryString["operfun"]; int operid = Convert.ToInt32(Request.QueryString["operid"]); if (fun == "edit") { string sql = "select * from [qingjia] where Q_ID=" + operid; using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql)) { if (dr.Read()) { person = new qingjia(); _ID.Text = dr["Q_ID"].ToString(); ddl_shixiang.Text = dr["q_shixiang"].ToString(); string str2 = dr.GetString(dr.GetOrdinal("q_startdate")); string[] sArray = str2.Split(' '); startdate.Text = sArray[0]; string[] time1 = sArray[1].Split(':'); time11_d1.Text = time1[0]; time11_d2.Text = time1[1]; string str1 = dr.GetString(dr.GetOrdinal("q_enddate")); string[] sArray1 = str1.Split(' '); enddate.Text = sArray1[0]; string[] time2 = sArray1[1].Split(':'); time12_d1.Text = time2[0]; time12_d2.Text = time2[1]; thing.Text = dr["q_things"].ToString(); tianall.Text = dr["q_all"].ToString(); } } } } Calendar1.Visible = false; Calendar2.Visible = false; }