예제 #1
0
        private void BindGridView(int nPageNo)
        {
            cefDoctype objEfDoctype = new cefDoctype();
            DataTable  dt;
            string     strMessage         = string.Empty;
            string     strCriteria        = string.Empty;
            string     stref_doctype_name = string.Empty;

            stref_doctype_name = txtef_doctype_name.Text.Replace("'", "''").Trim();
            if (!stref_doctype_name.Equals("0"))
            {
                strCriteria = strCriteria + "  And  (ef_doctype_name like '%" + stref_doctype_name + "%')";
            }
            try
            {
                dt = objEfDoctype.SP_DOCTYPE_SEL(strCriteria);

                try
                {
                    GridView1.PageIndex   = nPageNo;
                    txthTotalRecord.Value = dt.Rows.Count.ToString();
                    dt.DefaultView.Sort   = ViewState["sort"] + " " + ViewState["direction"];
                    GridView1.DataSource  = dt;
                    GridView1.DataBind();
                }
                catch
                {
                    GridView1.PageIndex   = 0;
                    txthTotalRecord.Value = dt.Rows.Count.ToString();
                    dt.DefaultView.Sort   = ViewState["sort"] + " " + ViewState["direction"];
                    GridView1.DataSource  = dt;
                    GridView1.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
            finally
            {
                objEfDoctype.Dispose();
                if (GridView1.Rows.Count > 0)
                {
                    GridView1.TopPagerRow.Visible = true;
                }
            }
        }
예제 #2
0
        private void setData()
        {
            cefDoctype objECefDoctype = new cefDoctype();
            DataTable  dt;
            string     strMessage = string.Empty, strCriteria = string.Empty;
            string     strdoctype_code = string.Empty,
                       strdoctype_name = string.Empty,
                       strCreatedBy    = string.Empty,
                       strUpdatedBy    = string.Empty,
                       strCreatedDate  = string.Empty,
                       strUpdatedDate  = string.Empty;

            try
            {
                strCriteria = " and ef_doctype_code = '" + ViewState["ef_doctype_code"].ToString() + "' ";
                dt          = objECefDoctype.SP_DOCTYPE_SEL(strCriteria);
                if (dt.Rows.Count > 0)
                {
                    #region get Data
                    strdoctype_code = dt.Rows[0]["ef_doctype_code"].ToString();
                    strdoctype_name = dt.Rows[0]["ef_doctype_name"].ToString();
                    strCreatedBy    = dt.Rows[0]["c_created_by"].ToString();
                    strUpdatedBy    = dt.Rows[0]["c_updated_by"].ToString();
                    strCreatedDate  = dt.Rows[0]["d_created_date"].ToString();
                    strUpdatedDate  = dt.Rows[0]["d_updated_date"].ToString();
                    #endregion

                    #region set Control
                    txtdoctype_code.Text = strdoctype_code;
                    txtdoctype_name.Text = strdoctype_name;

                    txtUpdatedBy.Text   = strUpdatedBy;
                    txtUpdatedDate.Text = strUpdatedDate;
                    #endregion
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
        }