📄 showdetail.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using DBUtils;
namespace BlueHill.Performance
{
/// <summary>
/// ShowDetail 的摘要说明。
/// </summary>
public class ShowDetail : System.Web.UI.Page
{
public Employee emp;
protected System.Web.UI.WebControls.Panel pnlPageFix;
protected System.Web.UI.WebControls.Label lblIsManager;
protected System.Web.UI.WebControls.Label lblPerformID;
protected System.Web.UI.WebControls.Label lblEmpID;
protected System.Web.UI.WebControls.Label lblYear;
protected System.Web.UI.WebControls.Label lblSeason;
protected System.Web.UI.WebControls.Label lblPerformItemID;
protected System.Web.UI.WebControls.Label lblOrgSelfScore;
protected System.Web.UI.WebControls.Label lblOrgReviewScore;
protected System.Web.UI.WebControls.Label lblNoLast;
protected System.Web.UI.WebControls.Label lblPerformStatusText;
protected System.Web.UI.WebControls.Label lblPerformStatus;
protected System.Web.UI.WebControls.Panel pnlStatus;
protected System.Web.UI.WebControls.Label lblLastObject;
protected System.Web.UI.WebControls.DataGrid grdLast;
protected System.Web.UI.WebControls.Label lblSelfComment;
protected System.Web.UI.WebControls.TextBox txtSelfComment;
protected System.Web.UI.WebControls.Label lblReviewComment;
protected System.Web.UI.WebControls.TextBox txtReviewComment;
protected System.Web.UI.WebControls.Label lblSelfScore;
protected System.Web.UI.WebControls.DropDownList cmbSelfScore;
protected System.Web.UI.WebControls.Label lblReviewScore;
protected System.Web.UI.WebControls.DropDownList cmbReviewScore;
protected System.Web.UI.WebControls.Button btnSave;
protected System.Web.UI.WebControls.Button btnCheckOver;
protected System.Web.UI.WebControls.Panel pnlLast;
protected System.Web.UI.WebControls.Label lblNextObject;
protected System.Web.UI.WebControls.TextBox txtNewObject;
protected System.Web.UI.WebControls.Button btnAdd;
protected System.Web.UI.WebControls.DataGrid grdNext;
protected System.Web.UI.WebControls.Panel pnlNext;
protected System.Web.UI.WebControls.Label lblDeptID;
protected System.Web.UI.WebControls.Panel pnlBody;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack)
{
int EmployeeID = Convert.ToInt32(Session["EmployeeID"]);
int iEmpID;
iEmpID = Convert.ToInt32(Session["iEmpID"].ToString());
int iRetValue;
int iYear = Convert.ToInt32(Session["iYear"]);
int iSeason = Convert.ToInt32(Session["iSeason"]);
bool IsManager = Convert.ToBoolean(Session["IsManager"]);
lblEmpID.Text = iEmpID.ToString();
lblYear.Text = iYear.ToString();
lblSeason.Text = iSeason.ToString();
lblIsManager.Text = IsManager.ToString();
if(IsManager)
{
pnlNext.Visible = false;
int iCEOID = 0;
int iRetValue0 = Employee.GetCEOInfo(ref iCEOID);
if(iRetValue0== 0)
{
this.RegisterStartupScript("out","<script>alert('操作失败');</script>");
}
else
{
if(iCEOID==EmployeeID)
{
lblNoLast.Text = "对不起,您不能查看,请退出";
pnlLast.Visible = false;
grdNext.Visible = false;
}
else
{
int iPerformID = Convert.ToInt32(Session["iPerformID"]);
lblPerformID.Text = iPerformID.ToString();
btnCheckOver.Visible = true;
txtSelfComment.ReadOnly = true;
cmbSelfScore.Enabled = false;
DataSet dsResult = new DataSet();
iRetValue = DBUtils.Performance.GetPerformItem
(iEmpID,iYear,iSeason,ref dsResult);
if(iRetValue == (int)DBResult.Success)
{
if(dsResult.Tables[0].Rows.Count>0)
{
pnlLast.Visible = true;
grdLast.DataSource = dsResult.Tables[0];
grdLast.DataBind();
bool isChecked = false;
int iRetValue1 = DBUtils.Performance.CheckIfReviewed(iEmpID,iYear,iSeason,ref isChecked);
if(iRetValue1 ==(int)DBResult.Success)
{
if(isChecked)
{
lblPerformStatus.Text = "不可修改";
grdLast.Columns[4].Visible = false;
lblSelfComment.Visible = false;
txtSelfComment.Visible = false;
}
else
{
lblPerformStatus.Text = "可修改";
grdLast.Enabled = true;
lblSelfComment.Visible = true;
txtSelfComment.Visible = true;
}
}
else this.RegisterStartupScript("out","<script>alert('操作失败');</script>");
DataSet dsResult1 = new DataSet();
iRetValue1 = DBUtils.Performance.GetPerformance(iEmpID,iYear,iSeason,ref dsResult1);
if(iRetValue1 ==(int)DBResult.Success)
{
if(dsResult1.Tables[0].Rows.Count>0)
{
string strSelfComment = dsResult1.Tables[0].Rows[0]["SelfComment"].ToString();
string strReviewComment = dsResult1.Tables[0].Rows[0]["ReviewComment"].ToString();
txtSelfComment.Text = strSelfComment;
txtReviewComment.Text = strReviewComment;
lblPerformID.Text = dsResult.Tables[0].Rows[0]["PerformID"].ToString();
}
}
}
else
{
lblNoLast.Visible = true;
pnlLast.Visible = false;
}
}
else
{
this.RegisterStartupScript("out","<script>alert('操作失败');</script>");
}
}
}
}
else
{
btnCheckOver.Visible = false;
txtReviewComment.ReadOnly = true;
cmbReviewScore.Enabled = false;
DataSet dsResult = new DataSet();
iRetValue = DBUtils.Performance.GetPerformItem
(iEmpID,iYear,iSeason,ref dsResult);
if(iRetValue == (int)DBResult.Success)
{
if(dsResult.Tables[0].Rows.Count>0)
{
pnlLast.Visible = true;
grdLast.DataSource = dsResult.Tables[0];
grdLast.DataBind();
bool isChecked = false;
int iRetValue1 = DBUtils.Performance.CheckIfReviewed(iEmpID,iYear,iSeason,ref isChecked);
if(iRetValue1 ==(int)DBResult.Success)
{
if(isChecked)
{
lblPerformStatus.Text = "不可修改";
grdLast.Columns[4].Visible = false;
lblSelfComment.Visible = false;
txtSelfComment.Visible = false;
btnSave.Visible = false;
btnCheckOver.Visible = false;
}
else
{
lblPerformStatus.Text = "可修改";
grdLast.Enabled = true;
lblSelfComment.Visible = true;
txtSelfComment.Visible = true;
}
}
else this.RegisterStartupScript("out","<script>alert('操作失败');</script>");
DataSet dsResult1 = new DataSet();
iRetValue1 = DBUtils.Performance.GetPerformance(iEmpID,iYear,iSeason,ref dsResult1);
if(iRetValue1 ==(int)DBResult.Success)
{
if(dsResult1.Tables[0].Rows.Count>0)
{
string strSelfComment = dsResult1.Tables[0].Rows[0]["SelfComment"].ToString();
string strReviewComment = dsResult1.Tables[0].Rows[0]["ReviewComment"].ToString();
txtSelfComment.Text = strSelfComment;
txtReviewComment.Text = strReviewComment;
lblPerformID.Text = dsResult.Tables[0].Rows[0]["PerformID"].ToString();
}
}
}
else
{
lblNoLast.Visible = true;
pnlLast.Visible = false;
}
RebindNextGrd();
}
else
{
this.RegisterStartupScript("out","<script>alert('操作失败');</script>");
}
}
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.grdLast.ItemCreated += new System.Web.UI.WebControls.DataGridItemEventHandler(this.grdLast_ItemCreated);
this.grdLast.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.grdLast_CancelCommand);
this.grdLast.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.grdLast_EditCommand);
this.grdLast.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.grdLast_UpdateCommand);
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
this.btnCheckOver.Click += new System.EventHandler(this.btnCheckOver_Click);
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
this.grdNext.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.grdNext_CancelCommand);
this.grdNext.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.grdNext_EditCommand);
this.grdNext.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.grdNext_UpdateCommand);
this.grdNext.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.grdNext_DeleteCommand);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
//该方法设定并显示本季度业绩报告所对应的 DataGrid 控件。
//该过程调用 Performance.GetPerformItem(iEmpID, iYear, iSeason, dsLastItem) 函数,
//从数据库中获取本季度的业绩报告的具体目标。
private void RebindLastGrd()
{
int iEmpID = Convert.ToInt32(lblEmpID.Text);
int iYear = Convert.ToInt32(lblYear.Text);
int iSeason = Convert.ToInt32(lblSeason.Text);
pnlLast.Visible = true;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -