public void DataGrid_PageChanged(object sender,DataGridPageChangedEventArgs e) { Username = (string)Session["Username"]; this.dgList .CurrentPageIndex = e.NewPageIndex; Task task = new Task(); DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType)); this.dgList .DataSource = mydb.DefaultView; this.dgList.DataBind(); setgrid(); }
public void bindtaskgrid() { UDS.Components.Task task = new UDS.Components.Task(); DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,1)); //TODO:���ﲻ֪��Ϊʲô����5����Ҫ����հ�¼��5�����������������д���һ�в�һ�����ַ��� //if(mydb.Rows.Count<5) //{ // int tmp = 5-mydb.Rows.Count; // for(int i=0;i<tmp;i++) // { // DataRow myDataRow = mydb.NewRow(); // myDataRow[0] = "-"; // mydb.Rows.Add(myDataRow); // } //} this.dgList .DataSource = mydb.DefaultView; this.dgList.DataBind(); // setgrid(); mydb.Dispose(); }
public void bindtaskgrid() { UDS.Components.Task task = new UDS.Components.Task(); DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,1)); if(mydb.Rows.Count<5) { int tmp = 5-mydb.Rows.Count; for(int i=0;i<tmp;i++) { DataRow myDataRow = mydb.NewRow(); myDataRow[0] = "-"; myDataRow[0] = "-"; mydb.Rows.Add(myDataRow); } } this.dgList .DataSource = mydb.DefaultView; this.dgList.DataBind(); // setgrid(); mydb.Dispose(); }
public void bindtaskgrid() { UDS.Components.Task task = new UDS.Components.Task(); DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(), Username, 1)); //TODO:这里不知道为什么不满5条,要补充空白记录到5条,但是这里明显有错误,第一列不一定是字符串 //if(mydb.Rows.Count<5) //{ // int tmp = 5-mydb.Rows.Count; // for(int i=0;i<tmp;i++) // { // DataRow myDataRow = mydb.NewRow(); // myDataRow[0] = "-"; // mydb.Rows.Add(myDataRow); // } //} this.dgList.DataSource = mydb.DefaultView; this.dgList.DataBind(); // setgrid(); mydb.Dispose(); }
private void Page_Load(object sender, System.EventArgs e) { HttpCookie UserCookie = Request.Cookies["Username"]; if (null != UserCookie) { Username = UserCookie.Value.ToString(); } string result = Request.QueryString["result"]; if(!Page.IsPostBack) { if (string.IsNullOrEmpty(result)) { //���ڲ��� DutyOperation(); Bangding(); bindtaskgrid(); } else { switch(result) { case "task": UDS.Components.Task task = new UDS.Components.Task(); DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(), Username, 1)); List<UDSTask> retTasks = new List<UDSTask>(); foreach (DataRow dr in mydb.Rows) { UDSTask t = new UDSTask(); t.ID = int.Parse(dr["ID"].ToString()); t.Subject = dr["Subject"].ToString(); t.BeginPeriodID = int.Parse(dr["beginPeriodID"].ToString()); t.EndPeriodID = int.Parse(dr["endPeriodID"].ToString()); t.EndTime = dr.IsNull("EndTime") ? "" : DateTime.Parse(dr["EndTime"].ToString()).ToShortDateString(); retTasks.Add(t); } var jsonSer = new Newtonsoft.Json.JsonSerializer(); StringWriter sw = new StringWriter(); using (JsonWriter jw = new JsonTextWriter(sw)) { jw.Formatting = Formatting.Indented; jsonSer.Serialize(jw, retTasks); } Response.Clear(); Response.ContentType = "application/json"; Response.Write(sw.ToString()); sw.Close(); //HttpContext.Current.ApplicationInstance.CompleteRequest(); Response.End(); break; } } } }
private void lnkbtnToday_Click(object sender, System.EventArgs e) { string Username = (string)Session["Username"]; this.btnCancelSubscription.Visible = false; this.btnCancel.Visible = true; displayType = 1; this.tblContainer.Rows[0].Cells[0].Attributes.Add("background","../../images/maillistbutton2.gif"); this.tblContainer.Rows[0].Cells[1].Attributes.Add("background","../../images/maillistbutton1.gif"); this.tblContainer.Rows[0].Cells[2].Attributes.Add("background","../../images/maillistbutton1.gif"); this.tblContainer.Rows[0].Cells[3].Attributes.Add("background","../../images/maillistbutton1.gif"); this.tblContainer.Rows[0].Cells[4].Attributes.Add("background","../../images/maillistbutton1.gif"); Task task = new Task(); DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType)); this.dgList .DataSource = mydb.DefaultView; this.dgList.DataBind(); setgrid(); mydb.Dispose(); }
private void InitData() { Username = (string)Session["Username"]; this.tblContainer.Rows[0].Cells[0].Attributes.Add("background","../../images/maillistbutton2.gif"); this.btnNew.Attributes["onclick"]= "var newwin=window.open('Manage.aspx','newtask','toolbar=yes,scrollbars=yes,width=800,height=600,resizable=yes');newwin.moveTo(0,0);newwin.focus();"; Task task = new Task(); this.dgList.Visible = true; this.btnAccept .Visible = true; this.btnCancel.Visible = true; //this.lnkbtnAdd.Attributes.Add("onclick","return dialwinprocess('"+DateTime.Today.ToShortDateString()+"','8','1','0')"); //this.lnkbtnAdd.Attributes.Add("onclick","self.location='CalendarView.aspx?Action=1';return true;"); DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType)); this.dgList .DataSource = mydb.DefaultView; this.dgList.DataBind(); setgrid(); mydb.Dispose(); for(int t=0;t<4;t++) { if(t==displayType-1) this.tblContainer.Rows[0].Cells[t].Attributes.Add("background","../../images/maillistbutton2.gif"); else this.tblContainer.Rows[0].Cells[t].Attributes.Add("background","../../images/maillistbutton1.gif"); } }
protected void myCalendar_DayRender(object sender, DayRenderEventArgs e) { UDS.Components.Task task = new UDS.Components.Task(); DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(), Username, 1)); Literal ltl = new Literal(); e.Cell.Controls.Clear(); ltl.Text = ""; ltl.Text = "<a href='#' onclick=\"javascript:window.open('../Schedule/Manage.aspx','newtask','toolbar=yes,scrollbars=yes,width=800,height=600,resizable=yes');\"> " + e.Day.Date.Day + " </A>"; //ltl.Text += "<DIV class=\"BlackDate\">" + e.Day.Date.Day + "</DIV>"; //ltl.Text += e.Day.Date == myCalendar.TodaysDate ? "<DIV class=\"RedDate\">" + e.Day.Date.Day + "</DIV>" : "<DIV class=\"WhiteDate\">" + e.Day.Date.Day + "</DIV>"; e.Cell.Controls.Add(ltl); foreach (DataRow dr in mydb.Rows) { if (DateTime.Parse(dr["Date"].ToString()).ToShortDateString() == e.Day.Date.ToShortDateString()) { // e.Cell.BackColor = System.Drawing.Color.Yellow; e.Cell.Controls.Clear(); ltl.Text = ""; ltl.Text = "<a href=\"javascript:dialwinprocess('','','2','" + dr["ID"].ToString() + "');\"> <font color='#FF0000'>" + e.Day.Date.Day + " </font></A>"; //ltl.Text += "<DIV class=\"BlackDate\">" + e.Day.Date.Day + "</DIV>"; //ltl.Text += e.Day.Date == myCalendar.TodaysDate ? "<DIV class=\"RedDate\">" + e.Day.Date.Day + "</DIV>" : "<DIV class=\"WhiteDate\">" + e.Day.Date.Day + "</DIV>"; e.Cell.Controls.Add(ltl); } //else //{ // e.Cell.Controls.Clear(); // ltl.Text = ""; // ltl.Text = "<a href='#' onclick=\"javascript:window.open('../Schedule/Manage.aspx','newtask','toolbar=yes,scrollbars=yes,width=800,height=600,resizable=yes');\"> " + e.Day.Date.Day + " </A>"; // //ltl.Text += "<DIV class=\"BlackDate\">" + e.Day.Date.Day + "</DIV>"; // //ltl.Text += e.Day.Date == myCalendar.TodaysDate ? "<DIV class=\"RedDate\">" + e.Day.Date.Day + "</DIV>" : "<DIV class=\"WhiteDate\">" + e.Day.Date.Day + "</DIV>"; // e.Cell.Controls.Add(ltl); //} } //DateTime nextDate; //Literal ltl = new Literal(); // nextDate = DateTime.Now; // if (nextDate.ToShortDateString() == e.Day.Date.ToShortDateString()) // { // e.Cell.BackColor = System.Drawing.Color.Blue; // e.Cell.Controls.Clear(); // ltl.Text = ""; // ltl.Text = "<a class=date href=\"javascript:location.href='http://www.google.com';\"> " + e.Day.Date.Day + " </A>"; // //ltl.Text += "<DIV class=\"BlackDate\">" + e.Day.Date.Day + "</DIV>"; // //ltl.Text += e.Day.Date == myCalendar.TodaysDate ? "<DIV class=\"RedDate\">" + e.Day.Date.Day + "</DIV>" : "<DIV class=\"WhiteDate\">" + e.Day.Date.Day + "</DIV>"; // e.Cell.Controls.Add(ltl); // } }
private void Page_Load(object sender, System.EventArgs e) { HttpCookie UserCookie = Request.Cookies["Username"]; if (null != UserCookie) { Username = UserCookie.Value.ToString(); } string result = Request.QueryString["result"]; if (!Page.IsPostBack) { if (string.IsNullOrEmpty(result)) { //考勤操作 DutyOperation(); Bangding(); bindtaskgrid(); } else { switch (result) { case "task": UDS.Components.Task task = new UDS.Components.Task(); DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(), Username, 1)); List <UDSTask> retTasks = new List <UDSTask>(); foreach (DataRow dr in mydb.Rows) { UDSTask t = new UDSTask(); t.ID = int.Parse(dr["ID"].ToString()); t.Subject = dr["Subject"].ToString(); t.BeginPeriodID = int.Parse(dr["beginPeriodID"].ToString()); t.EndPeriodID = int.Parse(dr["endPeriodID"].ToString()); t.EndTime = dr.IsNull("EndTime") ? "" : DateTime.Parse(dr["EndTime"].ToString()).ToShortDateString(); retTasks.Add(t); } var jsonSer = new Newtonsoft.Json.JsonSerializer(); StringWriter sw = new StringWriter(); using (JsonWriter jw = new JsonTextWriter(sw)) { jw.Formatting = Formatting.Indented; jsonSer.Serialize(jw, retTasks); } Response.Clear(); Response.ContentType = "application/json"; Response.Write(sw.ToString()); sw.Close(); //HttpContext.Current.ApplicationInstance.CompleteRequest(); Response.End(); break; } } } }