private void BindApplys(int curPageIndex) { var bll = new FlexPlusBLL(); var pager = new Pager(); pager.CurrentPageIndex = curPageIndex; pager.srcOrder = " ID desc"; var mTB_DormAreaApply = new TB_DormAreaApply(); mTB_DormAreaApply.EmployeeNo = txtWorkDayNo.Text.Trim(); mTB_DormAreaApply.CName = txtName.Text.Trim(); mTB_DormAreaApply.CardNo = txtScanCardNO.Text.Trim(); int nVal = 0; int.TryParse(ddlRequiredType.SelectedValue, out nVal); mTB_DormAreaApply.RequireType = nVal; nVal = -1; int.TryParse(ddlDormArea.SelectedValue, out nVal); mTB_DormAreaApply.DormAreaID = nVal; nVal = -1; int.TryParse(ddlStatus.SelectedValue, out nVal); mTB_DormAreaApply.Status = nVal; var dt = bll.GetApplyDorms(mTB_DormAreaApply, ref pager); GridView1.DataSource = dt; GridView1.DataBind(); this.Pager1.ItemCount = pager.TotalRecord; this.Pager1.PageCount = pager.TotalPage; this.Pager1.CurrentIndex = pager.CurrentPageIndex; this.Pager1.PageSize = pager.PageSize; }
public DataTable GetApplyDorms(TB_DormAreaApply mVal, Pager pager) { var sb = new StringBuilder("select * from V_TB_DormAreaApply "); var db = DBO.GetInstance(); DataTable dt = null; DbCommand dbCommandWrapper = null; dbCommandWrapper = db.DbProviderFactory.CreateCommand(); dbCommandWrapper.CommandType = CommandType.Text; sb.Append("where 1=1 "); if (mVal.ID > 0) { sb.AppendFormat("and id={0} ", mVal.ID); } if (mVal.DormAreaID > 0) { sb.AppendFormat("and DormAreaID={0} ", mVal.DormAreaID); } if (!string.IsNullOrEmpty(mVal.CName)) { sb.AppendFormat("and CName='{0}' ", mVal.CName); } if (!string.IsNullOrEmpty(mVal.CardNo)) { sb.AppendFormat("and CardNo='{0}' ", mVal.CardNo); } if (!string.IsNullOrEmpty(mVal.EmployeeNo)) { sb.AppendFormat("and EmployeeNo='{0}' ", mVal.EmployeeNo); } if (!string.IsNullOrEmpty(mVal.MobileNo)) { sb.AppendFormat("and MobileNo='{0}' ", mVal.MobileNo); } if (mVal.RequireType > 0) { sb.AppendFormat("and RequireType={0} ", mVal.RequireType); } if (mVal.Status > -1) { sb.AppendFormat("and Status={0} ", mVal.Status); } if (pager != null && !pager.IsNull) { dbCommandWrapper.CommandText = pager.GetPagerSql4Count(sb.ToString()); dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0]; pager.TotalRecord = Convert.ToInt32(dt.Rows[0][0]); dbCommandWrapper.CommandText = pager.GetPagerSql4Data(sb.ToString(), DataBaseTypeEnum.sqlserver); } else { dbCommandWrapper.CommandText = sb.ToString(); } dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0]; return(dt); }
private void InitData(string[] mKeys) { if (mKeys.Length > 1) { ddlDormArea.Enabled = false; //txtReply.Disabled = true; ddlHandle_SelectedIndexChanged(null, null); } else { //加载旧数据,限制提交 var bll = new FlexPlusBLL(); var mTB_DormAreaApply = new TB_DormAreaApply(); int nID = 0; int.TryParse(mKeys[0], out nID); mTB_DormAreaApply.ID = nID; Framework.Pager pager = null; var dt = bll.GetApplyDorms(mTB_DormAreaApply, ref pager); if (!DataTableHelper.IsEmptyDataTable(dt)) { var dr = dt.Rows[0]; int nStatus = 0; nStatus = Convert.ToInt32(dr["Status"]); if (nStatus != 0) { var sLastResp = dr["Response"].ToString(); txtReply.Value = sLastResp; ddlDormArea.Enabled = false; ddlHandle.Enabled = false; txtReply.Disabled = true; btnSave.Visible = false; btnSave.Enabled = false; } else { ddlHandle_SelectedIndexChanged(null, null); txtReply.Disabled = false; txtReply.Focus(); } } } }
private void InitData(string sid) { int nID = 0; int.TryParse(sid, out nID); if (0 == nID) { return; } var bll = new FlexPlusBLL(); var mTB_DormAreaApply = new TB_DormAreaApply(); mTB_DormAreaApply.ID = nID; Framework.Pager pager = null; var dt = bll.GetApplyDorms(mTB_DormAreaApply, ref pager); if (DataTableHelper.IsEmptyDataTable(dt)) { return; } int nTemp = 0; var dr = dt.Rows[0]; txtEmployeeNo.Text = dr["EmployeeNo"].ToString(); txtCName.Text = dr["CName"].ToString(); nTemp = 0; int.TryParse(dr["Sex"].ToString(), out nTemp); txtSex.Text = nTemp > 0 ? "男" : "女"; txtCardNo.Text = dr["CardNo"].ToString(); txtCreateDate.Text = dr["CreateDate"].ToString(); txtHandler.Text = dr["ModifyUserID"].ToString(); txtUpdateDate.Text = dr["UpdateDate"].ToString(); txtDormArea.Text = dr["DormArea"].ToString(); txtGrade.Text = dr["Grade"].ToString(); nTemp = 0; int.TryParse(dr["HasHousingAllowance"].ToString(), out nTemp); txtHasHousingAllowance.Text = nTemp > 0 ? "是" : "否"; txtmemo.Value = dr["memo"].ToString(); txtMobileNo.Text = dr["MobileNo"].ToString(); txtRequireReason.Value = dr["RequireReason"].ToString(); nTemp = 0; int.TryParse(dr["RequireType"].ToString(), out nTemp); var sTemp = string.Empty; switch (nTemp) { case 2: sTemp = "复入住"; break; case 3: sTemp = "调房"; break; default: sTemp = "新入住"; break; } txtRequireType.Text = sTemp; }
public DataTable GetApplyDorms(TB_DormAreaApply mTB_DormAreaApply, ref Pager pager) { return(_mDAL.GetApplyDorms(mTB_DormAreaApply, pager)); }