PageRenderTime 13ms CodeModel.GetById 8ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

/EQT_V1/EQTWebApp/TaskAdmin.aspx.cs

http://sgsoft-las.googlecode.com/
C# | 121 lines | 92 code | 13 blank | 16 comment | 13 complexity | 862a5781eb3e5744fa8a21f2b3607cde MD5 | raw file
Possible License(s): LGPL-2.1
  1using System;
  2using System.Data;
  3using System.Configuration;
  4using System.Collections;
  5using System.Web;
  6using System.Web.Security;
  7using System.Web.UI;
  8using System.Web.UI.WebControls;
  9using System.Web.UI.WebControls.WebParts;
 10using System.Web.UI.HtmlControls;
 11using EQT.Model;
 12using EQT.Dal;
 13using EQT.Bll;
 14
 15public partial class TaskAdmin : System.Web.UI.Page
 16{
 17    private DaDept dalDept = new DaDept(DaCommon.DefaultDb);
 18    private DaEmployee daemp = new DaEmployee(DaCommon.DefaultDb);
 19    private DaReportAudit dara = new DaReportAudit(DaCommon.DefaultDb);
 20
 21    protected void Page_Load(object sender, EventArgs e)
 22    {
 23        if (!Page.IsPostBack)
 24        {
 25            //??????????
 26            Utility.BindListCtl2Dic(DropDownListStatus, ContractStatusCollection.TesterGrpStatus);
 27            InitDefaultFitler();
 28            LoadTaskList();
 29        }
 30    }
 31
 32    private void InitDefaultFitler()
 33    {
 34        DateTime default_begin_day = new DateTime(DateTime.Today.Year, 1, 1);
 35        TextBoxBegin.Text = default_begin_day.ToString(SiteConfig.DateFormat);
 36        TextBoxEnd.Text = DateTime.Now.AddDays(1).ToString(SiteConfig.DateFormat);
 37        DropDownListStatus.SelectedIndex = DropDownListStatus.Items.IndexOf(DropDownListStatus.Items.FindByValue(ContractStatus.ALL.ToString()));
 38        TextBoxReportId.Text = String.Empty;
 39        TextBoxCorpName.Text = String.Empty;
 40    }
 41
 42    /// <summary>
 43    /// ??????
 44    /// </summary>
 45    private void LoadTaskList()
 46    {
 47        System.Text.StringBuilder sb = new System.Text.StringBuilder();
 48        //????????
 49        sb.Append(DaCoTestItem.SQL_GET_CO_TEST_ITEM);
 50        sb.Append(" WHERE ");
 51        sb.Append(Utility.GenerateQueryFilter2DateTime("Report_Create_Time", TextBoxBegin.Text, TextBoxEnd.Text));
 52        string filter = Utility.GenerateQueryFilterString("Report_ID", TextBoxReportId.Text, 2);
 53        if (filter != null) sb.AppendFormat(" AND {0} ", filter);
 54        filter = Utility.GenerateQueryFilterString("Corp_Name", TextBoxCorpName.Text, 2);
 55        if (filter != null) sb.AppendFormat(" AND {0} ", filter);
 56
 57        sb.AppendFormat(" AND {0}", Utility.GenerateQueryFilterIntMaskAnd("Report_Status", "&", Int32.Parse(DropDownListStatus.SelectedValue)));
 58        string sql = sb.ToString();
 59
 60
 61        if (Utility.GlobalLog.IsDebugEnabled) Utility.GlobalLog.Debug(sql);
 62        int totalCount = 0;
 63        DataSet ds = DaCommon.GetPaginationData(sql,
 64            SiteConfig.PageSize, AspNetPager1.CurrentPageIndex - 1, "Report_Create_Time DESC", out totalCount);
 65        AspNetPager1.PageSize = SiteConfig.PageSize;
 66        AspNetPager1.RecordCount = totalCount;
 67        GridViewTestItems.DataSource = ds;
 68        GridViewTestItems.DataBind();
 69    }
 70
 71
 72    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
 73    {
 74        LoadTaskList();
 75    }
 76    protected void btnFilterQuery_Click(object sender, EventArgs e)
 77    {
 78        AspNetPager1.CurrentPageIndex = 0;
 79        LoadTaskList();
 80    }
 81    protected void btnQueryAll_Click(object sender, EventArgs e)
 82    {
 83        AspNetPager1.CurrentPageIndex = 0;
 84        InitDefaultFitler();
 85        LoadTaskList();
 86    }
 87
 88    /// <summary>
 89    /// ??????.????????????????????
 90    /// </summary>
 91    /// <param name="sender"></param>
 92    /// <param name="e"></param>
 93    protected void BtnAssignCoTestItem_Click(object sender, EventArgs e)
 94    {
 95        //????
 96        LoadTaskList();
 97    }
 98   
 99     
100    /// <summary>
101    /// ????????????????????????????
102    /// </summary>
103    /// <param name="sender"></param>
104    /// <param name="e"></param>
105    protected void GridViewTestItems_RowDataBound(object sender, GridViewRowEventArgs e)
106    {
107        if (e.Row.RowType == DataControlRowType.DataRow)
108        {
109            Button BtnAssignCoTestItem = e.Row.FindControl("BtnAssignCoTestItem") as Button;
110            if (BtnAssignCoTestItem != null && BtnAssignCoTestItem.Visible)
111            {
112                DataRowView drv = e.Row.DataItem as DataRowView;
113                int state = (int)drv["Test_Status"];
114                BtnAssignCoTestItem.Visible = !(state >= (int)CoTestItemStatus.TestDone && state < (int)CoTestItemStatus.Untread);
115                if(BtnAssignCoTestItem.Visible)
116                BtnAssignCoTestItem.Attributes.Add("OnClick", "InvokePopSelectTester('" + drv["Item_Code"] + "','" + drv["Co_Item_ID"] + "')");
117               
118            }
119        }
120    }
121}