public List <ShiJuanEntity> GetAllEnableShiJuan(ShiJuanSearchEntity shiJuanSearchEntity)
        {
            List <ShiJuanEntity> listShiJuan = new List <ShiJuanEntity>();
            string strSql = string.Format(@"select *from shi_juan where is_deleted=0 
order by id limit {0},{1};",
                                          shiJuanSearchEntity.pageIndex * shiJuanSearchEntity.pageSize, shiJuanSearchEntity.pageSize);
            DataTable dtShiJuan = WebApiForShiTiKu.Helper.MySqlHelper.ExecuteTable(strSql);

            if (dtShiJuan != null && dtShiJuan.Rows.Count > 0)
            {
                foreach (DataRow dr in dtShiJuan.Rows)
                {
                    int           id            = dr["id"] == DBNull.Value?0:Convert.ToInt32(dr["id"].ToString());
                    string        shiJuanName   = dr["shi_juan_name"] == DBNull.Value ? string.Empty : dr["shi_juan_name"].ToString();
                    int           isDeleted     = dr["is_deleted"] == DBNull.Value ? 0 : Convert.ToInt32(dr["is_deleted"].ToString());
                    DateTime      dtCt          = dr["c_t"] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr["c_t"].ToString());
                    DateTime      dtUt          = dr["u_t"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(dr["u_t"].ToString());
                    ShiJuanEntity shiJuanEntity = new ShiJuanEntity();
                    shiJuanEntity.id          = id;
                    shiJuanEntity.shiJuanName = shiJuanName;
                    shiJuanEntity.isDeleted   = isDeleted;
                    shiJuanEntity.cT          = dtCt;
                    shiJuanEntity.uT          = dtUt;
                    listShiJuan.Add(shiJuanEntity);
                }
            }

            return(listShiJuan);
        }
示例#2
0
        private void btnPre_Click(object sender, EventArgs e)
        {
            try
            {
                if (nPageIndex == 0)
                {
                    MessageBox.Show("已经是第一页了");
                    return;
                }
                string              strShiJuanName      = txtShiJuanName.Text.Trim();
                DateTime            dtBegin             = dtpBegin.Value;
                DateTime            dtEnd               = dtpEnd.Value;
                ShiJuanSearchEntity shiJuanSearchEntity = new ShiJuanSearchEntity();
                nPageIndex = nPageIndex - 1;
                shiJuanSearchEntity.pageIndex = nPageIndex;
                shiJuanSearchEntity.pageSize  = nPageSize;
                shiJuanSearchEntity.beginTime = dtBegin;
                shiJuanSearchEntity.endTime   = dtEnd;
                if (strShiJuanName != string.Empty)
                {
                    shiJuanSearchEntity.shiJuanName = strShiJuanName;
                }

                string jsonPar = JsonHelper.ToJson(shiJuanSearchEntity);
                string realUrl = ConfigHelper.ConfigHelper.GetApiRootUrl() + urlPart_Search;
                doSearch(realUrl, jsonPar);
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询前一页失败," + ex.Message);
            }
        }
示例#3
0
        public void doBind()
        {
            try
            {
                string              strShiJuanName      = txtShiJuanName.Text.Trim();
                DateTime            dtBegin             = dtpBegin.Value;
                DateTime            dtEnd               = dtpEnd.Value;
                ShiJuanSearchEntity shiJuanSearchEntity = new ShiJuanSearchEntity();
                nPageIndex = 0;
                shiJuanSearchEntity.pageIndex = nPageIndex;
                shiJuanSearchEntity.pageSize  = nPageSize;
                shiJuanSearchEntity.beginTime = dtBegin;
                shiJuanSearchEntity.endTime   = dtEnd;
                if (strShiJuanName != string.Empty)
                {
                    shiJuanSearchEntity.shiJuanName = strShiJuanName;
                }

                string jsonPar = JsonHelper.ToJson(shiJuanSearchEntity);
                string realUrl = ConfigHelper.ConfigHelper.GetApiRootUrl() + urlPart_Search;
                doSearch(realUrl, jsonPar);
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询试卷失败," + ex.Message);
            }
        }
示例#4
0
        private void FrmShiJuanManager_Load(object sender, EventArgs e)
        {
            //DataGridView不能选择
            this.dgvShiJuan.RowHeadersVisible = false;

            //DataGridView 去除未绑定的字段
            this.dgvShiJuan.AutoGenerateColumns = false;
            this.dgvShiJuan.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;//设置为整行被选中
            try
            {
                dtpBegin.Value = DateTime.Now.AddYears(-50);
                dtpEnd.Value   = DateTime.Now.AddDays(1);
                ShiJuanSearchEntity shiJuanSearchEntity = new ShiJuanSearchEntity();
                nPageIndex = 0;
                shiJuanSearchEntity.pageIndex = nPageIndex;
                shiJuanSearchEntity.pageSize  = nPageSize;
                shiJuanSearchEntity.beginTime = dtpBegin.Value;
                shiJuanSearchEntity.endTime   = dtpEnd.Value;

                string jsonPar = JsonHelper.ToJson(shiJuanSearchEntity);
                string realUrl = ConfigHelper.ConfigHelper.GetApiRootUrl() + urlPart_Search;
                doSearch(realUrl, jsonPar);
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询试卷失败," + ex.Message);
            }
        }
        public List <ShiJuanEntity> GetEnableShiJuanByCondition(ShiJuanSearchEntity shiJuanSearchEntity)
        {
            List <ShiJuanEntity> listShiJuan = new List <ShiJuanEntity>();
            int nRowCount = 0;

            string strSqlRowCount = string.Format(@"
select count(1) rowCount from shi_juan 
where is_deleted=0 
and shi_juan_name like'%{0}%' 
and c_t BETWEEN '{1}' and '{2}'; ",
                                                  shiJuanSearchEntity.shiJuanName, shiJuanSearchEntity.beginTime, shiJuanSearchEntity.endTime);
            object objRowCount = WebApiForShiTiKu.Helper.MySqlHelper.ExecuteScalar(strSqlRowCount);

            if (objRowCount != null)
            {
                nRowCount = Convert.ToInt32(objRowCount);
            }
            string strSql = string.Format(@"
select *from shi_juan 
where is_deleted=0 
and shi_juan_name like'%{0}%' 
and c_t BETWEEN '{1}' and '{2}'  
order by id limit {3},{4};",
                                          shiJuanSearchEntity.shiJuanName, shiJuanSearchEntity.beginTime, shiJuanSearchEntity.endTime,
                                          shiJuanSearchEntity.pageIndex * shiJuanSearchEntity.pageSize, shiJuanSearchEntity.pageSize);
            DataTable dtShiJuan = WebApiForShiTiKu.Helper.MySqlHelper.ExecuteTable(strSql);

            if (dtShiJuan != null && dtShiJuan.Rows.Count > 0)
            {
                nRowCount = dtShiJuan.Rows.Count;
                foreach (DataRow dr in dtShiJuan.Rows)
                {
                    int           id            = dr["id"] == DBNull.Value ? 0 : Convert.ToInt32(dr["id"].ToString());
                    string        shiJuanName   = dr["shi_juan_name"] == DBNull.Value ? string.Empty : dr["shi_juan_name"].ToString();
                    int           isDeleted     = dr["is_deleted"] == DBNull.Value ? 0 : Convert.ToInt32(dr["is_deleted"].ToString());
                    DateTime      dtCt          = dr["c_t"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(dr["c_t"].ToString());
                    DateTime      dtUt          = dr["u_t"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(dr["u_t"].ToString());
                    ShiJuanEntity shiJuanEntity = new ShiJuanEntity();
                    shiJuanEntity.id          = id;
                    shiJuanEntity.shiJuanName = shiJuanName;
                    shiJuanEntity.isDeleted   = isDeleted;
                    shiJuanEntity.cT          = dtCt;
                    shiJuanEntity.uT          = dtUt;
                    listShiJuan.Add(shiJuanEntity);
                }
            }

            return(listShiJuan);
        }
示例#6
0
        private void txtCurrentPage_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    string strCurrentPage = txtCurrentPage.Text.Trim();
                    int    nCurrentPage   = 0;
                    if (!int.TryParse(strCurrentPage, out nCurrentPage))
                    {
                        return;
                    }
                    if ((nCurrentPage - 1) < 0)
                    {
                        return;
                    }
                    if (nCurrentPage > nPageCount)
                    {
                        return;
                    }

                    string              strShiJuanName      = txtShiJuanName.Text.Trim();
                    DateTime            dtBegin             = dtpBegin.Value;
                    DateTime            dtEnd               = dtpEnd.Value;
                    ShiJuanSearchEntity shiJuanSearchEntity = new ShiJuanSearchEntity();
                    nPageIndex = nCurrentPage - 1;
                    shiJuanSearchEntity.pageIndex = nPageIndex;
                    shiJuanSearchEntity.pageSize  = nPageSize;
                    shiJuanSearchEntity.beginTime = dtBegin;
                    shiJuanSearchEntity.endTime   = dtEnd;
                    if (strShiJuanName != string.Empty)
                    {
                        shiJuanSearchEntity.shiJuanName = strShiJuanName;
                    }

                    string jsonPar = JsonHelper.ToJson(shiJuanSearchEntity);
                    string realUrl = ConfigHelper.ConfigHelper.GetApiRootUrl() + urlPart_Search;
                    doSearch(realUrl, jsonPar);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("导航试卷异常," + ex.Message);
            }
        }
        public ReturnResultEntity <PageResultEntity <ShiJuanEntity> > GetEnableShiJuanByCondition(ShiJuanSearchEntity shiJuanSearchEntity)
        {
            ReturnResultEntity <PageResultEntity <ShiJuanEntity> > returnMessageEntity = new ReturnResultEntity <PageResultEntity <ShiJuanEntity> >();
            List <ShiJuanEntity> listShiJuan = new List <ShiJuanEntity>();
            int           nRowCount          = 0;
            StringBuilder sbWhere            = new StringBuilder();

            sbWhere.Append(" where is_deleted=0  ");
            if (shiJuanSearchEntity.shiJuanName != null)
            {
                sbWhere.Append(string.Format(" and shi_juan_name like'%{0}%' ", shiJuanSearchEntity.shiJuanName));
            }
            if (shiJuanSearchEntity.beginTime != null)
            {
                sbWhere.Append(string.Format(" and c_t >='{0}' ", shiJuanSearchEntity.beginTime));
            }
            if (shiJuanSearchEntity.endTime != null)
            {
                sbWhere.Append(string.Format(" and c_t <='{0}' ", shiJuanSearchEntity.endTime));
            }
            string strSqlRowCount = "select count(1) rowCount from shi_juan " + sbWhere.ToString();
            object objRowCount    = WebApiForShiTiKu.Helper.MySqlHelper.ExecuteScalar(strSqlRowCount);

            if (objRowCount != null)
            {
                nRowCount = Convert.ToInt32(objRowCount);
            }
            string strLimit = string.Format(" order by id limit {0},{1}",
                                            shiJuanSearchEntity.pageIndex * shiJuanSearchEntity.pageSize, shiJuanSearchEntity.pageSize);
            string strSql = "select *from shi_juan" + sbWhere.ToString() + strLimit;

            DataTable dtShiJuan = WebApiForShiTiKu.Helper.MySqlHelper.ExecuteTable(strSql);

            if (dtShiJuan != null && dtShiJuan.Rows.Count > 0)
            {
                foreach (DataRow dr in dtShiJuan.Rows)
                {
                    int           id            = dr["id"] == DBNull.Value ? 0 : Convert.ToInt32(dr["id"].ToString());
                    string        shiJuanName   = dr["shi_juan_name"] == DBNull.Value ? string.Empty : dr["shi_juan_name"].ToString();
                    int           isDeleted     = dr["is_deleted"] == DBNull.Value ? 0 : Convert.ToInt32(dr["is_deleted"].ToString());
                    DateTime      dtCt          = dr["c_t"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(dr["c_t"].ToString());
                    DateTime      dtUt          = dr["u_t"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(dr["u_t"].ToString());
                    ShiJuanEntity shiJuanEntity = new ShiJuanEntity();
                    shiJuanEntity.id          = id;
                    shiJuanEntity.shiJuanName = shiJuanName;
                    shiJuanEntity.isDeleted   = isDeleted;
                    shiJuanEntity.cT          = dtCt;
                    shiJuanEntity.uT          = dtUt;
                    listShiJuan.Add(shiJuanEntity);
                }
            }
            PageResultEntity <ShiJuanEntity> pageResultEntity = new PageResultEntity <ShiJuanEntity>();

            pageResultEntity.rowCount   = nRowCount;
            pageResultEntity.dataList   = listShiJuan;
            returnMessageEntity.success = true;
            returnMessageEntity.data    = pageResultEntity;

            return(returnMessageEntity);
        }