Ejemplo n.º 1
0
        /// <summary>
        /// 选择数据
        /// </summary>
        protected void refresh()
        {
            DataView dv = new CawApprovalSetDB().Select();
            GridView1.DataSource = dv;
            GridView1.DataBind();

            //调用一个js函数,用于强制执行datagrid的颜色变换。如不用,因updatapanel中数据更新后将无法引起datagridcolor.js的执行
            CallJsFun("ChangeColor();");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获得通过的查询
        /// </summary>
        /// <param name="dgList"></param>
        /// <param name="Table_Name"></param>
        /// <param name="CorGuid"></param>
        /// <param name="DateFrom"></param>
        /// <param name="DateTo"></param>
        /// <param name="PageSize"></param>
        /// <param name="CurrentPageIndex"></param>
        /// <param name="TotalNum"></param>
        /// <param name="Message"></param>
        public void GetApprovalList(System.Web.UI.WebControls.DataGrid dgList, string Table_Name, string CorGuid, string DateFrom, string DateTo, int PageSize, int CurrentPageIndex, out int TotalNum, out string Message)
        {
            DataView dvList = new CawApprovalSetDB().Select(Table_Name);
            if(dvList.Count<1)
            {
                Message="审批信息还没有配置,请先至审批配置页面进行审批信息配置";
                TotalNum = 0;
                return;
            }
            //添加隐藏列GUID
            BoundColumn col =new BoundColumn();
            col.DataField = "GUID";
            col.Visible = false;
            dgList.Columns.Add(col);

            string col_En = "COMPANY_NAME," + dvList[0]["COLLIST"].ToString().Trim() + ",SUBMITDATE,DATASTATUS_NAME";
            string col_Cn = "企业名称," + dvList[0]["COLLIST_CN"].ToString().Trim() + ",申请日期,审批状态";
            string[] colList = col_En.Split(',');
            string[] colList_Cn = col_Cn.Split(',');

            //添加显示列
            for (int i = 0; i < colList.Length; i++)
            {
                BoundColumn col1 = new BoundColumn();
                col1.HeaderText = colList_Cn[i];
                col1.DataField = colList[i];
                col1.HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                col1.ItemStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                dgList.Columns.Add(col1);
            }

            string Where = " AND B.DATASTATUS='2'";
            Where += CorGuid == "" ? "" : " AND A." + dvList[0]["QUERYFIELD"].ToString().Trim() + "='" + CorGuid + "'";

            Where += (DateFrom != "" && DateTo == "") ? " AND B.SUBMITDATE >=TO_DATE('" + DateFrom + "','yyyy-mm-dd')" : "";
            Where += (DateFrom == "" && DateTo != "") ? " AND B.SUBMITDATE <=TO_DATE('" + DateTo + "','yyyy-mm-dd')" : "";
            Where += (DateFrom != "" && DateTo != "") ? " AND B.SUBMITDATE >=TO_DATE('" + DateFrom + "','yyyy-mm-dd') AND B.SUBMITDATE <=TO_DATE('" + DateTo + "','yyyy-mm-dd')" : "";
            string strSql = " SELECT '' AS TMP,A." + dvList[0]["COLLIST"].ToString().Trim().Replace(",",",A.") + ",A." + dvList[0]["KEYFIELD"].ToString().Trim() + " AS GUID,B.DATASTATUS_NAME,TO_CHAR(B.SUBMITDATE,'yyyy-mm-dd') SUBMITDATE,C.NAME AS COMPANY_NAME FROM " + Table_Name + " A INNER JOIN CAW_DATESTATUS B ON A." + dvList[0]["KEYFIELD"].ToString().Trim() + "=B.KEYGUID INNER JOIN CAW_COMPANY C ON A." + dvList[0]["QUERYFIELD"].ToString().Trim() + "=C.GUID" + Where;
            strSql = FrameCommon.GetPageSql(CawConnStr, out TotalNum, CurrentPageIndex, PageSize, strSql, "GUID", " ORDER BY SUBMITDATE DESC");
            Database db = DatabaseFactory.CreateDatabase(CawConnStr);
            DbCommand cmd = db.GetSqlStringCommand(strSql);
            try
            {
                dgList.DataSource = db.ExecuteDataView(cmd);
                dgList.DataBind();
                Message = "";
            }
            catch(Exception err)
            {
                Message = "审批信息配置错误";
                TotalNum = 0;
                return;
            }
        }
 private void InitiData()
 {
     string Guid = Request.QueryString["guid"];
     List<Detail_CAW_APPROVALSET> DataList = new CawApprovalSetDB().GetSet(Guid);
     string[] Name_Cn = DataList[0].COLLIST_CN.Split(',');
     int Flag = 0;
     foreach (DataGridItem item in this.GridView1.Items)
     {
         if (DataList[0].COLLIST.IndexOf(((Label)item.Cells[1].FindControl("lblName")).Text) > -1)
         {
             ((CheckBox)item.Cells[5].FindControl("chkShow")).Checked = true;
             ((TextBox)item.Cells[3].FindControl("txtName")).Text = Name_Cn[Flag];
             Flag += 1;
         }
         if (DataList[0].QUERYFIELD.IndexOf(((Label)item.Cells[1].FindControl("lblName")).Text) > -1)
         {
             ((CheckBox)item.Cells[6].FindControl("chkQuery")).Checked = true;
         }
         if (DataList[0].KEYFIELD.IndexOf(((Label)item.Cells[1].FindControl("lblName")).Text) > -1)
         {
             ((CheckBox)item.Cells[4].FindControl("chkKey")).Checked = true;
         }
     }
 }