using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using WeiSha.Common; using Song.ServiceInterfaces; using Song.Entities; using WeiSha.WebControl; namespace Song.Site.Manage.Common { public partial class TaskWorker : Extend.CustomPage { protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { //设置查询的起止时间 //tbStart.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"); //tbEnd.Text = DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd"); BindData(null, null); } } /// /// 绑定列表 /// protected void BindData(object sender, EventArgs e) { try { //总记录数 int count = 0; //状态 string state = this.ddlState.SelectedItem.Value; //等级 int level = Convert.ToInt16(ddlLevel.SelectedItem.Value); //查询字符 string sear = tbSear.Text.Trim(); DateTime startTime = DateTime.Now.AddYears(-100); //开始时间与结束时间 if (tbStart.Text.Trim() != "") { startTime = Convert.ToDateTime(tbStart.Text.Trim()); } DateTime endTime = DateTime.Now.AddYears(100); if (this.tbEnd.Text.Trim() != "") { endTime = Convert.ToDateTime(tbEnd.Text.Trim()); } endTime = endTime.AddDays(1).AddSeconds(-1); //当前登录用户id EmpAccount acc = Extend.LoginState.Admin.CurrentUser; Song.Entities.Task[] task = null; task = Business.Do().GetWorkerPager(acc.Acc_Id, false, startTime, endTime, state, level, sear, Pager1.Size, Pager1.Index, out count); GridView1.DataSource = task; GridView1.DataKeyNames = new string[] { "Task_Id" }; GridView1.DataBind(); Pager1.RecordAmount = count; } catch (Exception ex) { Message.ExceptionShow(ex); } } protected void btnsear_Click(object sender, EventArgs e) { Pager1.Index = 1; BindData(null, null); } /// /// 删除 /// /// /// protected void DeleteEvent(object sender, EventArgs e) { try { string keys = GridView1.GetKeyValues; foreach (string mid in keys.Split(',')) { Business.Do().Delete(Convert.ToInt16(mid)); } BindData(null, null); } catch (Exception ex) { Message.ExceptionShow(ex); } } /// /// 获取任务的剩余时间 /// /// /// protected double getRemainingTime(string endTime) { try { DateTime end = Convert.ToDateTime(endTime); TimeSpan span = end - System.DateTime.Now; return Math.Round(span.TotalHours * 100) / 100; } catch (Exception ex) { Message.ExceptionShow(ex); return 0; } } } }