Пример #1
0
    /// <summary>
    /// 綁定查詢
    /// </summary>
    private void dataSearch()
    {
        Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal();
        this.ddlFieldName.DataSource = dal.SearchTable(FormID, false).Tables[0];
        this.ddlFieldName.DataTextField = "FieldCName";
        this.ddlFieldName.DataValueField = "FieldName";
        this.ddlFieldName.DataBind();

        this.ddlPageSize.Items.Add(new ListItem("15", "15"));
        this.ddlPageSize.Items.Add(new ListItem("20", "20"));
        this.ddlPageSize.Items.Add(new ListItem("25", "25"));
        this.ddlPageSize.Items.Add(new ListItem("30", "30"));
        this.ddlPageSize.Items.Add(new ListItem("40", "40"));
        this.ddlPageSize.Items.Add(new ListItem("50", "50"));
    }
Пример #2
0
    private void dataBind(int PageIndex)
    {
        int record_Count = 0;
        int PageCount =0;
        Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal(cnKey);
        DataTable dt = dal.GetSearchSelectSQL(FormID, PageIndex, strWhere, GridView1.PageSize, out PageCount, out record_Count, out SelectField).Tables[0];

        string strOptionTxt = "";
        DataTable dt1 = dal.SearchTable(FormID, true).Tables[0];
        for (int i = 0; i < dt1.Rows.Count; i++)
        {
            if (dt1.Rows[i]["FieldType"].ToString().ToLower() == "tinyint" && dt1.Rows[i]["controltype"].ToString().ToLower() == "dropdownlist" && dt1.Rows[i]["OptionText"].ToString().Trim() != "")
            {
                if (strOptionTxt=="")
                    strOptionTxt = dt1.Rows[i]["FieldCName"].ToString() + ":" + dt1.Rows[i]["OptionText"].ToString().Trim();
                else
                    strOptionTxt += "|" + dt1.Rows[i]["FieldCName"].ToString() + ":" + dt1.Rows[i]["OptionText"].ToString().Trim();
            }
        }

        optionTxt = strOptionTxt.Split('|');
        Field = SelectField.Split(spliter, StringSplitOptions.None);
        if (dt == null || dt.Rows.Count <= 0)
        {
            IsExists = "0";
            //Js.Common.MessageBox.Show(this, "");
            return;
        }
        ViewState["PageCount"] = PageCount;
        if (PageCount > 0)
        {
            this.btnLast.Enabled = true;
            this.btnFirst.Enabled = true;
            this.btnToPage.Enabled = true;
            if (int.Parse(ViewState["CurrentPage"].ToString()) > 1)
                this.btnPre.Enabled = true;
            else
                this.btnPre.Enabled = false;
            if (int.Parse(ViewState["CurrentPage"].ToString()) < PageCount)
                this.btnNext.Enabled = true;
            else
                this.btnNext.Enabled = false;
            lblPage.Visible = true;
            lblPage.Text = "共 [" + record_Count + "] 筆記錄  第 [" + ViewState["CurrentPage"] + "] 頁  共 [" + PageCount + "] 頁";
            GridView1.DataSource = dt;
            GridView1.PageIndex = PageIndex;
            GridView1.DataBind();
        }
        else
        {
            this.btnFirst.Enabled = false;
            this.btnPre.Enabled = false;
            this.btnNext.Enabled = false;
            this.btnLast.Enabled = false;
            this.btnToPage.Enabled = false;
            lblPage.Visible = false;
            GridView1.DataSource = "";
            GridView1.DataBind();
        }
        for (int i = 0; i < dt.Columns.Count; i++)
        {
            if (dt.Columns[i].DataType.ToString() == "System.DateTime")
            {

            }
        }
    }
Пример #3
0
    /// <summary>
    /// 綁定查詢
    /// </summary>
    private void dataSearch()
    {
        Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal();
        this.ddlFieldName.DataSource = dal.SearchTable(FormID, false).Tables[0];
        this.ddlFieldName.DataTextField = "FieldCName";
        this.ddlFieldName.DataValueField = "FieldName";
        this.ddlFieldName.DataBind();

        this.ddlPageSize.Items.Add(new ListItem("15", "15"));
        this.ddlPageSize.Items.Add(new ListItem("20", "20"));
        this.ddlPageSize.Items.Add(new ListItem("25", "25"));
        this.ddlPageSize.Items.Add(new ListItem("30", "30"));
        this.ddlPageSize.Items.Add(new ListItem("40", "40"));
        this.ddlPageSize.Items.Add(new ListItem("50", "50"));

        Js.BLL.BaseDal bdal = new Js.BLL.BaseDal("BU_Enterprise");
        string filter = "1=1";
        if (Session["UserType"].ToString() == "EP")
            filter = string.Format("EnterpriseID='{0}'", Session["EnterpriseID"].ToString());
        this.ddlEnterpriseID.DataSource = bdal.GetIDNameList(filter);
        this.ddlEnterpriseID.DataTextField = "IDName";
        this.ddlEnterpriseID.DataValueField = "ID";
        this.ddlEnterpriseID.DataBind();

        if (Session["UserType"].ToString() == "BU")
            this.ddlEnterpriseID.Items.Insert(0, new ListItem("", ""));
        if (Session["EnterpriseID"] != null)
            this.ddlEnterpriseID.SelectedValue = Session["EnterpriseID"].ToString();
    }
Пример #4
0
 private void Bind()
 {
     Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal();
     DataTable dt = dal.SearchTable(FormID, false).Tables[0];
     this.ddlFieldName.DataSource = dal.SearchTable(FormID, false).Tables[0];
     this.ddlFieldName.DataTextField = "FieldCName";
     this.ddlFieldName.DataValueField = "FieldCName";
     this.ddlFieldName.DataBind();
 }