?? tasklist.aspx.cs
字號:
this.btnAccept.Enabled = (Username.ToLower()==ActualUsername.ToLower());
this.btnCancel.Enabled = (Username.ToLower()==ActualUsername.ToLower());
this.btnNew.Enabled = (Username.ToLower()==ActualUsername.ToLower());
this.btnSubscribe.Visible = (Username.ToLower()!=ActualUsername.ToLower());
this.btnSubscribe.Enabled = (Username.ToLower()!=ActualUsername.ToLower());
}
public void populateData()
{
#region 協同人員列表初始化
string Username = (string)Session["Username"];
UDS.Components .Staff staff = new UDS.Components .Staff();
try
{
listStaff.DataTextField = "RealName";
listStaff.DataValueField = "Staff_Name";
listStaff.DataSource = staff.GetStaffFromPosition(ActualUsername);
listStaff.DataBind();
foreach(ListItem li in listStaff.Items)
{
if(li.Value.ToLower() ==Username.ToLower())
{
li.Selected =true;
}
}
// listStaff.SelectedItem .Value = Username;
// listStaff.SelectedItem .Text = UDS.Components .Staff.GetRealNameByUsername(Username);
}
catch(Exception e)
{
UDS.Components.Error.Log(e.ToString());
Server.Transfer("../Error.aspx");
}
finally
{
staff = null;
}
#endregion
}
public class demodat
{
private int m_StartTime;
private int m_EndTime;
public int StartTime
{
//文件ID
get { return m_StartTime; }
set { m_StartTime = value; }
}
public int EndTime
{
//文檔ID
get { return m_EndTime; }
set { m_EndTime = value; }
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:該調用是 ASP.NET Web 窗體設計器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.btnAccept.Click += new System.EventHandler(this.btnAccept_Click);
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
this.btnSubscribe.Click += new System.EventHandler(this.btnSubscribe_Click);
this.listStaff.SelectedIndexChanged += new System.EventHandler(this.listStaff_SelectedIndexChanged);
this.lnkbtnToday.Click += new System.EventHandler(this.lnkbtnToday_Click);
this.lnkbtnHistory.Click += new System.EventHandler(this.lnkbtnHistory_Click);
this.lnkbtnFinished.Click += new System.EventHandler(this.lnkbtnFinished_Click);
this.Linkbutton1.Click += new System.EventHandler(this.Linkbutton1_Click);
this.lnkbtnArranged.Click += new System.EventHandler(this.lnkbtnArranged_Click);
this.btnWeeklyView.Click += new System.EventHandler(this.btnWeeklyView_Click);
this.btnCancelSubscription.Click += new System.EventHandler(this.btnCancelSubscription_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
public string GetStatus(string str)
{
switch (str)
{
case "0":
return "?"; // 待定
case "1":
return "!"; // 待辦
case "2":
return "√"; // 完成
default:
return "";
}
}
public string GetPeriodByPeriodID(string EndTime,string begintime,string endtime)
{
if(begintime=="0"&&endtime=="0")
{
return DateTime.Parse(EndTime).ToShortTimeString()+"(截止)";
}
else if(begintime=="1"&&endtime=="20")
{
return "(全天)";
}
else
{
int b = Int32.Parse(begintime);
int e = Int32.Parse(endtime);
DateTime dt = new DateTime(1999,1,1,8,0,0,0);
TimeSpan ts = new TimeSpan(0,0,(b-1)*30,0,0);
DateTime bt = dt.Add(ts);
DateTime et = bt.Add(new TimeSpan(0,0,(e-b+1)*30,0,0));
return bt.ToShortTimeString()+"-"+et.ToShortTimeString();
}
}
public string GetRealName(string Username)
{
if(Username!="")
return UDS.Components.Staff.GetRealNameByUsername(Username);
else
return "";
}
public string GetRealNameStr(string Username)
{
if(Username!="")
return UDS.Components.Staff.GetRealNameStrByUsernameStr(Username,3);
else
return "";
}
public string GetType(string type)
{
string Type="";
if(type!="")
{
switch (Int32.Parse(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;
}
return Type;
}
else
return "";
}
public string GetProjectName(string project)
{
if(project!="")
return UDS.Components .ProjectClass .GetProjectName (Int32.Parse(project));
else
return "";
}
private void setgrid()
{
foreach(DataGridItem dgi in this.dgList .Items)
{
Label lb=(Label)(dgi.Cells[3].Controls[1]);
if(lb.Text=="?") dgi.BackColor=Color.AliceBlue ;
}
}
#region 翻頁事件
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();
}
#endregion
private void btnList_Click(object sender, System.EventArgs e)
{
string Username = (string)Session["Username"];
Task task = new Task();
this.dgList.Visible = true;
this.btnCancel .Visible = true;
this.btnAccept .Visible = true;
DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetTodayTaskBySomeone(DateTime.Today.ToShortDateString(),Username,1));
this.dgList .DataSource = mydb.DefaultView;
this.dgList.DataBind();
setgrid();
mydb.Dispose();
}
private void lnkbtnAccept_Click(object sender, System.EventArgs e)
{
string Username = (string)Session["Username"];
string ids = "";
foreach(DataGridItem dgi in this.dgList .Items)
{
CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]);
if (cb.Checked==true)
{
ids += dgList.DataKeys[dgi.ItemIndex].ToString()+",";
}
}
if(ids!="")
{
ids = ids.Substring(0,ids.Length-1);
Task task = new Task();
try
{
task.DealTask(ids,1,Username,DateTime.Today.ToShortDateString());
Response.Write("<script language=javascript>alert('操作成功!');window.location='TaskList.aspx';</script>");
//Response.AddHeader("Refresh","1");
}
catch(Exception ex)
{
UDS.Components .Error.Log(ex.ToString());
Server.Transfer("../Error.aspx");
}
}
}
private void lnkbtnCancel_Click(object sender, System.EventArgs e)
{
string Username = (string)Session["Username"];
string ids = "";
foreach(DataGridItem dgi in this.dgList .Items)
{
CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]);
if (cb.Checked==true)
{
ids += dgList.DataKeys[dgi.ItemIndex].ToString()+",";
}
}
if(ids!="")
{
ids = ids.Substring(0,ids.Length-1);
Task task = new Task();
try
{
task.DealTask(ids,0,Username,DateTime.Today .ToShortDateString());
Response.Write("<script language=javascript>alert('操作成功!');window.location='TaskList.aspx';</script>");
//Response.AddHeader("Refresh","1");
}
catch(Exception ex)
{
UDS.Components .Error.Log(ex.ToString());
Server.Transfer("../Error.aspx");
}
}
}
private void lnkbtnFinish_Click(object sender, System.EventArgs e)
{
string Username = (string)Session["Username"];
string ids = "";
foreach(DataGridItem dgi in this.dgList .Items)
{
CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]);
if (cb.Checked==true)
{
ids += dgList.DataKeys[dgi.ItemIndex].ToString()+",";
}
}
if(ids!="")
{
ids = ids.Substring(0,ids.Length-1);
Task task = new Task();
try
{
task.DealTask(ids,2,Username,DateTime.Today.ToShortDateString());
Response.Write("<script language=javascript>alert('操作成功!');window.location='TaskList.aspx';</script>");
//Response.AddHeader("Refresh","1");
}
catch(Exception ex)
{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -