using BLL; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace FineUIPro.Web.CQMS.Check { public partial class CheckEquipment : PageBase { /// /// 项目id /// public string ProjectId { get { return (string)ViewState["ProjectId"]; } set { ViewState["ProjectId"] = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ProjectId = this.CurrUser.LoginProjectId; GetButtonPower(); BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList1(drpUserUnit, this.CurrUser.LoginProjectId, true); BindGrid(); } } private void BindGrid() { string strSql = "select C.CheckEquipmentId,C.ProjectId,B.UnitName AS UserUnit,Isdamage,EquipmentName,Format,SetAccuracyGrade,CompileMan, RealAccuracyGrade,CheckCycle, CheckDay,(case IsIdentification when 'true' then '是' when 'false' then '否' else '' end) IsIdentification,(case IsCheckCertificate when 'true' then '是' when 'false' then '否' else '' end) IsCheckCertificate,U.UserName,C.State from[dbo].[Check_CheckEquipment] C left join Sys_User U on C.CompileMan=U.UserId left join Base_Unit B on C.UserUnitId=B.UnitId"; List listStr = new List(); strSql += " where C.ProjectId = @ProjectId"; listStr.Add(new SqlParameter("@ProjectId", this.ProjectId)); if (drpUserUnit.SelectedValue != BLL.Const._Null) { strSql += " AND C.UserUnitId=@UserUnitId"; listStr.Add(new SqlParameter("@UserUnitId", drpUserUnit.SelectedValue)); } if (!string.IsNullOrEmpty(this.txtEquipmentName.Text.Trim())) { strSql += @" and C.EquipmentName like @EquipmentName "; listStr.Add(new SqlParameter("@EquipmentName", "%" + this.txtEquipmentName.Text.Trim() + "%")); } if (this.rblIsBeOverdue.SelectedValue == "true") { strSql += " and dateadd(day,(CheckCycle*365),CheckDay) /// 获取按钮权限 /// /// /// private void GetButtonPower() { if (Request.Params["value"] == "0") { return; } var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.CheckEquipmentMenuId); if (buttonList.Count() > 0) { if (buttonList.Contains(BLL.Const.BtnModify)) { this.btnMenuModify.Hidden = false; } if (buttonList.Contains(BLL.Const.BtnDelete)) { this.btnMenuDel.Hidden = false; } } } #endregion protected void Window1_Close(object sender, WindowCloseEventArgs e) { BindGrid(); } /// /// 把状态转换代号为文字形式 /// /// /// protected string ConvertState(object state) { if (state != null) { if (state.ToString() == BLL.Const.CheckEquipment_ReCompile) { return "重新编制"; } else if (state.ToString() == BLL.Const.CheckEquipment_Compile) { return "编制"; } else if (state.ToString() == BLL.Const.CheckEquipment_Approve) { return "审核"; } else if (state.ToString() == BLL.Const.CheckEquipment_Complete) { return "审批完成"; } else { return ""; } } else { return ""; } } // //获取办理人姓名 // // // protected string ConvertMan(object designId) { if (designId != null) { Model.Check_CheckEquipmentApprove a = BLL.CheckEquipmentApproveService.GetCheckEquipmentApproveByCheckEquipmentId(designId.ToString()); if (a != null) { if (a.ApproveMan != null) { return BLL.UserService.GetUserByUserId(a.ApproveMan).UserName; } } else { return ""; } } return ""; } // //获取办理人姓名 // // // protected string ConvertIsBeOverdue(object CheckCycle, object CheckDay) { if (CheckCycle != null && CheckDay != null) { if (!string.IsNullOrEmpty(CheckCycle.ToString()) && !string.IsNullOrEmpty(CheckDay.ToString())) { var ResultData = Convert.ToDateTime(CheckDay).AddDays(Convert.ToDouble(CheckCycle) * 365); if (ResultData >= DateTime.Now) { return "未过期"; } else { return "过期"; } } } return ""; } protected void btnQuery_Click(object sender, EventArgs e) { BindGrid(); } protected void btnRset_Click(object sender, EventArgs e) { drpUserUnit.SelectedIndex = 0; txtEquipmentName.Text = ""; rblIsBeOverdue.SelectedValue = "0"; BindGrid(); } } }