/// <summary> /// 绑定修改时数据 /// </summary> private void PopulateReviseData() { SqlDataReader dataReader = null; ProjectClass prj = new ProjectClass(); try { dataReader = prj.GetProjectDetail(Int32.Parse(ClassID)); dataReader.Read(); this.txtClassName.Value = dataReader[0].ToString(); this.txtBrief.Value = dataReader[7].ToString(); this.txtScale.Value = dataReader[6].ToString(); this.txtStartDate.Text = dataReader.IsDBNull(3) ? "" : DateTime.Parse(dataReader[3].ToString()).ToString("yyyy-MM-dd"); this.txtEndDate.Text = dataReader.IsDBNull(4) ? "" : DateTime.Parse(dataReader[4].ToString()).ToString("yyyy-MM-dd"); this.Status.SelectedIndex = Int32.Parse(dataReader[5].ToString()); prj = null; dataReader = null; } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../Error.aspx"); } }
private void PopulateData(TaskClass tsk) { string ClassName = "", Type = ""; switch (tsk.Type) { case 1: Type = "会议"; break; case 2: Type = "文案"; break; case 3: Type = "来访"; break; case 4: Type = "电话"; break; case 5: Type = "走访"; break; case 6: Type = "外出"; break; case 7: Type = "假期"; break; case 8: Type = "出差"; break; } this.lblSubject.Text = tsk.Subject; this.lblDetail.Text = tsk.Detail; this.lblStartTime.Text = (DateTime.Parse(tsk.StartTime).ToShortTimeString() == "0:00")?DateTime.Parse(tsk.StartTime).ToShortDateString() + " 8:00":tsk.StartTime; this.lblEndTime.Text = (DateTime.Parse(tsk.EndTime).ToShortTimeString() == "0:00")?DateTime.Parse(tsk.EndTime).ToShortDateString() + " 18:00":tsk.EndTime; this.lblArrangedBy.Text = UDS.Components.Staff.GetRealNameByUsername(tsk.ArrangedBy); this.lblCooperator.Text = UDS.Components.Staff.GetRealNameStrByUsernameStr(tsk.CooperatorList, 0); this.lblType.Text = Type; this.lblAttribute.Text = tsk.Attribute.ToString() == "1"?"独占任务":"限时任务"; if (tsk.ProjectID != 0) { ProjectClass prj = new ProjectClass(); SqlDataReader dataReader = prj.GetProjectDetail(tsk.ProjectID); if (dataReader.Read()) { ClassName = dataReader["ClassName"].ToString(); } dataReader.Close(); prj = null; } this.lblProjectID.Text = (tsk.ProjectID == 0)?"无":"<a href='#' onclick=javascript:window.close();window.dialogArguments.location='../UnitiveDocument/Project.aspx?classID=" + tsk.ProjectID.ToString() + "'>" + ClassName + "</a>"; }