PageRenderTime 62ms CodeModel.GetById 41ms app.highlight 7ms RepoModel.GetById 0ms app.codeStats 0ms

/EQT_V2/EQT/EQTWebApp/EquipKeptQuery.aspx.cs

http://sgsoft-las.googlecode.com/
C# | 138 lines | 105 code | 20 blank | 13 comment | 8 complexity | c70f09e5e03ba0c8a5a20d6258da6b9c MD5 | raw file
Possible License(s): LGPL-2.1
  1/*----------------------------------------------------------------
  2// Copyright (C) 2009 
  3// ????? 
  4//
  5// ????
  6// ???????????????
  7//
  8//
  9// ?????
 10// ????????
 11// ?????
 12// ?????
 13//----------------------------------------------------------------*/
 14using System;
 15using System.Data;
 16using System.Configuration;
 17using System.Collections;
 18using System.Web;
 19using System.Web.Security;
 20using System.Web.UI;
 21using System.Web.UI.WebControls;
 22using System.Web.UI.WebControls.WebParts;
 23using System.Web.UI.HtmlControls;
 24using EQT.Dal;
 25using System.Threading;
 26using EQT.Model;
 27using Wuqi.Webdiyer;
 28
 29public partial class EquipKeptQuery : System.Web.UI.Page
 30{
 31    private static readonly Common.Logging.ILog log = Common.Logging.LogManager.GetCurrentClassLogger();
 32    private DaKeptLog dalKept = DevFuture.Common.WorkContext.AppCtx.GetObject("DaKeptLog") as DaKeptLog;
 33    private UserContext context;
 34
 35    protected void Page_Load(object sender, EventArgs e)
 36    {
 37        context = Session["USER_CONTEXT"] as UserContext;
 38        OperationResult.Text = "";
 39        divResult.Visible = false;
 40        AspNetPager.PageSize = 15;
 41
 42        if(!IsPostBack)
 43        {
 44            this.BtnQuery_Click(null, null);
 45        }
 46    }
 47
 48    protected void AspNetPager_PageChanged(object sender, EventArgs e)
 49    {
 50        this.BtnQuery_Click(null, null);
 51    }
 52
 53    protected void BtnQuery_Click(object sender, EventArgs e)
 54    {
 55        int pagecount = 0;
 56        string strCondition = "where 1=1 ";
 57        if (sender != null && e != null)
 58        {
 59            AspNetPager.CurrentPageIndex = 0;
 60        }
 61
 62        if (!string.IsNullOrEmpty(TxtEquipID.Text.Trim()))
 63        {
 64            strCondition = strCondition + "and  Equip_ID='" + TxtEquipID.Text.Trim() + "'";
 65        }
 66        
 67        this.GridView.DataSource = dalKept.GetEquipKeptRecords(strCondition, AspNetPager.PageSize, AspNetPager.CurrentPageIndex - 1, out pagecount);
 68        this.GridView.DataBind();
 69
 70        AspNetPager.RecordCount = pagecount;
 71
 72    }
 73
 74    protected void GvDetail_Click(object sender, EventArgs e)
 75    {
 76        LinkButton btn = sender as LinkButton;
 77        GridViewRow gvr = (GridViewRow)btn.NamingContainer;
 78        string strKey = ((GridView)gvr.NamingContainer).DataKeys[gvr.RowIndex].Value.ToString();
 79
 80        if (string.IsNullOrEmpty(strKey))
 81        {
 82            return;
 83        }
 84        DataSet ds = dalKept.GetEquipKeptRecords(" where Kpt_Log_ID='" + strKey + "'");
 85
 86        labEquip_ID.Text = ds.Tables[0].Rows[0]["Equip_ID"].ToString();
 87        labStatusName.Text = ds.Tables[0].Rows[0]["StatusName"].ToString();
 88        labEquip_Name.Text = ds.Tables[0].Rows[0]["Equip_Name"].ToString();
 89        labKpt_Addr.Text = ds.Tables[0].Rows[0]["Kpt_Addr"].ToString();
 90        labKpt_Begin.Text = ds.Tables[0].Rows[0]["Kpt_Begin"].ToString();
 91        labKpt_End.Text = ds.Tables[0].Rows[0]["Kpt_End"].ToString();
 92        labRem.Text = ds.Tables[0].Rows[0]["Rem"].ToString();
 93        labUser_Code1.Text = ds.Tables[0].Rows[0]["FullName1"].ToString();
 94        labUser_Code2.Text = ds.Tables[0].Rows[0]["FullName2"].ToString();
 95        this.SetPanelVisiable(DetailPanel);
 96    }
 97
 98    protected void BtnExport_Click(object sender, EventArgs e)
 99    {
100        string strCondition = "where 1=1 ";
101
102        if (!string.IsNullOrEmpty(TxtEquipID.Text.Trim()))
103        {
104            strCondition = strCondition + "and  Equip_ID='" + TxtEquipID.Text.Trim() + "'";
105        }
106
107        DataSet ds = dalKept.GetEquipKeptRecords(strCondition);
108
109        GridViewExport.DataSource = ds;
110        GridViewExport.DataBind();
111
112        GridViewExportUtil.Export("KeptRecords.xls", GridViewExport);
113        GridViewExport.DataSource = null;
114        GridViewExport.DataBind();
115    }
116
117    protected void DetailBack_Click(object sender, EventArgs e)
118    {
119        labEquip_ID.Text = "";
120        labKpt_Addr.Text = "";
121        labKpt_Begin.Text = "";
122        labKpt_End.Text = "";
123        labRem.Text = "";
124        labUser_Code1.Text = "";
125        labUser_Code2.Text = "";
126        labEquip_Name.Text = "";
127        labStatusName.Text = "";
128        this.SetPanelVisiable(SummaryPanel);
129    }
130
131    protected void SetPanelVisiable(Panel panel)
132    {
133        DetailPanel.Visible = false;
134        SummaryPanel.Visible = false;
135
136        panel.Visible = true;
137    }
138}