Пример #1
0
        private void btQuery_Click(object sender, System.EventArgs e)
        {
            Session.Remove("QUERY");
            Session.Remove("page_view");
            string strDeptID = this.ddlDept.SelectedValue;
            string strDate   = DateTime.Now.ToShortDateString();
            string strPType  = this.ddlProductType.SelectedValue;
            string strPClass = this.ddlProductClass.SelectedValue;

            string strOldDept = "";

            if (strPType == "FINALPRODUCT")
            {
                DataTable deptmap = (DataTable)Application["DeptMapInfo"];
                for (int i = 0; i < deptmap.Rows.Count; i++)
                {
                    if (deptmap.Rows[i]["cnvcNewDeptID"].ToString() == strDeptID)
                    {
                        strOldDept += deptmap.Rows[i]["cnvcOldDeptID"].ToString() + "','";
                    }
                }
                if (strOldDept.Substring(strOldDept.Length - 3, 3) == "','")
                {
                    strOldDept = strOldDept.Substring(0, strOldDept.Length - 3);
                }
            }

            Hashtable htPara = new Hashtable();

            htPara.Add("strDeptID", strDeptID);
            htPara.Add("strOldDept", strOldDept);
            htPara.Add("strDate", strDate);
//			htPara.Add("strYestoday",strYestoday);
            htPara.Add("strPType", strPType);
            htPara.Add("strPClass", strPClass);

            Hashtable htapp   = (Hashtable)Application["appconf"];
            string    strcons = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);
            try
            {
                DataTable dtout = StoBusi.GetCheckData(htPara);
                if (dtout == null)
                {
                    this.SetErrorMsgPageBydir("²éѯ³ö´í£¬ÇëÖØÊÔ£¡");
                    return;
                }
                else
                {
                    dtout.TableName = "ÏúÊÛÈÕÅ̵ã";
                    DataTable dtexcel = dtout.Copy();
                    Session["QUERY"] = dtout;
                    if (dtout.Rows.Count > 0)
                    {
                        this.btnEdit.Enabled = true;
                    }
                    else
                    {
                        this.btnEdit.Enabled = false;
                    }
                }

                this.btnCheckOk.Enabled      = false;
                this.btQuery.Enabled         = false;
                this.btnreset.Enabled        = true;
                this.ddlDept.Enabled         = false;
                this.ddlProductType.Enabled  = false;
                this.ddlProductClass.Enabled = false;

                if (strDeptID == "FYZX1")
                {
                    this.DataGrid1.Columns[7].Visible  = false;
                    this.DataGrid1.Columns[8].Visible  = false;
                    this.DataGrid1.Columns[12].Visible = false;
                    this.DataGrid1.Columns[6].Visible  = true;
                    this.DataGrid1.Columns[11].Visible = true;
                }
                else
                {
                    this.DataGrid1.Columns[7].Visible  = true;
                    this.DataGrid1.Columns[8].Visible  = true;
                    this.DataGrid1.Columns[12].Visible = true;
                    this.DataGrid1.Columns[6].Visible  = false;
                    this.DataGrid1.Columns[11].Visible = false;
                }
                this.DataGrid1.Columns[14].Visible = true;
                this.DataGrid1.Columns[15].Visible = false;

//				this.DataGrid1.PageSize = 30;
                this.DataGrid1.DataSource = dtout;
                this.DataGrid1.DataBind();
            }
            catch (Exception er)
            {
                this.clog.WriteLine(er);
                this.SetErrorMsgPageBydir("²éѯ´íÎó£¬ÇëÖØÊÔ£¡");
                return;
            }
        }