/// <summary> /// 查询指定页数的数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnFind_Click(object sender, EventArgs e) { if (txtPage.Text.Trim() == "") { untCommon.InfoMsg("请输入所要查询的页数。"); return; } try { curPage = int.Parse(this.txtPage.Text); } catch (FormatException) { untCommon.InfoMsg("所要查询的页数请输入数字。"); return; } if (curPage > TotalPage || curPage < 1) { untCommon.InfoMsg("没有您所要查询的页数。"); return; } DataTable dat = FixMgr.getLogList((curPage - 1) * pageCount, pageCount, _departId, _power); if (dat != null) { //绑定数据 dbgFix.DataSource = dat.DefaultView; } this.lblCurPage.Text = "第" + curPage.ToString() + "页"; }
/// <summary> /// 获取行列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private List <string> GetRowListBySQL(string Column) { DataTable dat = FixMgr.getEqRowList(_departId, _power, Column, SortsString); List <string> result = new List <string>();; for (int i = 0; i < dat.Rows.Count; i++) { result.Add(dat.Rows[i][0].ToString()); } return(result); }
/// <summary> /// 刷新筛选数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DataRefreshBySQL() { DataTable dat = FixMgr.getSortEqList((curPage - 1) * pageCount, pageCount, _departId, _power, SelectedColumns, SortsString, OrderByString[0]); if (dat != null) { TotalPage = this.getTotalPage();//得到数据的总页数 dbgFix.DataSource = dat.DefaultView; } this.lblTotalpage.Text = "共" + TotalPage.ToString() + "页"; this.lblCurPage.Text = "第" + curPage.ToString() + "页"; }
/// <summary> /// 首页 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnFirst_Click(object sender, EventArgs e) { curPage = 1; DataTable dat = FixMgr.getSortEqList(0, pageCount, _departId, _power, SelectedColumns, SortsString, OrderByString[0]); if (dat != null) { //绑定数据 dbgFix.DataSource = dat.DefaultView; } this.lblCurPage.Text = "第" + curPage.ToString() + "页"; }
/// <summary> /// 刷新数据 /// </summary> private void DataRefresh() { DataTable dat = FixMgr.getLogList((curPage - 1) * pageCount, pageCount, _departId, _power); if (dat != null) { TotalPage = this.getTotalPage();//得到数据的总页数 //绑定数据 dbgFix.DataSource = dat.DefaultView; } this.lblTotalpage.Text = "共" + TotalPage.ToString() + "页"; this.lblCurPage.Text = "第" + curPage.ToString() + "页"; }
public frmFix(string ID) { InitializeComponent(); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲 updata_flag = true; this.ID = ID; DataTable dt = FixMgr.GetOneFix(ID); this.cbxMaintainer.Text = dt.Rows[0][0].ToString(); this.dtpMDate.Value = Convert.ToDateTime(dt.Rows[0][1].ToString()); this.dtpRDate.Value = Convert.ToDateTime(dt.Rows[0][2].ToString()); this.textFixRemark.Text = dt.Rows[0][3].ToString(); this._eqno = dt.Rows[0][4].ToString(); this.frmFix_Load(null, null); }
/// <summary> /// 加载资产的资料; /// </summary> private void LoadEqInfo() { DataTable dt = FixMgr.GetOneAllFix(_id); if (dt != null) { this.textSerialNO.Text = dt.Rows[0][0].ToString(); this.textEqNO.Text = dt.Rows[0][1].ToString(); this.textName.Text = dt.Rows[0][2].ToString(); this.textDepartment.Text = dt.Rows[0][4].ToString(); this.textKeepPlace.Text = dt.Rows[0][5].ToString(); this.textKeeper.Text = dt.Rows[0][6].ToString(); this.textMaintainer.Text = dt.Rows[0][7].ToString(); this.textMAgent.Text = dt.Rows[0][8].ToString(); this.textMReviewer.Text = dt.Rows[0][9].ToString(); this.textMDate.Text = dt.Rows[0][10].ToString(); this.textRDate.Text = dt.Rows[0][14].ToString(); this.textMRemark.Text = dt.Rows[0][11].ToString(); } }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { if (this.checkBox1.Checked) { Fix fix = new Fix(); DataTable Empdt = EmployeeMgr.GetAllName(); fix.RAgent = this.name2ID(Empdt, this._user, "name"); fix.EqNo = this.textEqNO.Text; fix.RDate = this.dtpBDate1.Value; fix.rRemark = this.textRRemark.Text; if (_power == "0" || _power == "1") { bool flag = FixMgr.RUpdateWithoutVerify(_id, fix); flag = EqMgr.ReturnEq(fix.EqNo); } else { bool flag = FixMgr.RUpdate(_id, fix); } } this.DialogResult = DialogResult.OK; this.Close(); }
/// <summary> /// 得到信息的总页数 /// </summary> /// <returns></returns> private int getTotalPage() { int result = FixMgr.LogCount(); int Total; if (result != 0) { int count = FixMgr.LogCount() % pageCount; if (count == 0) { Total = FixMgr.LogCount() / pageCount; } else { Total = FixMgr.LogCount() / pageCount + 1; } } else { Total = 0; } return(Total); }
private void frmFixLook_Load(object sender, EventArgs e) { curPage = 1; DataTable dat = FixMgr.getLogList(0, pageCount, _departId, _power); if (dat != null) { dbgFix.DataSource = dat.DefaultView; AvailableColumns.Clear(); foreach (DataGridViewColumn c in dbgFix.Columns) { if (!c.Visible) { continue; } AvailableColumns.Add(c.HeaderText); SelectedColumns.Add(c.HeaderText); } dbgFix.ScrollBars = ScrollBars.Both; this.dbgFrozen(); } TotalPage = this.getTotalPage();//得到数据的总页数 this.lblTotalpage.Text = "共" + TotalPage.ToString() + "页"; }
private void btnOK_Click(object sender, EventArgs e) { Fix fix = new Fix(); fix.ID = this.textSerialNO.Text; fix.EqNo = this.textEqNO.Text; fix.EqName = this.textName.Text; DataTable Empdt = EmployeeMgr.GetAllName(); DataTable Depdt = DepartMgr.GetAllDepartment(); fix.Department = this.name2ID(Depdt, this.textDepartment.Text, "departName"); fix.KeepPlace = this.textKeepPlace.Text; fix.Keeper = this.name2ID(Empdt, this.textKeeper.Text, "name"); fix.Maintainer = this.cbxMaintainer.Text; fix.MAgent = this.name2ID(Empdt, _user, "name"); fix.MDate = this.dtpMDate.Value; fix.RDate = this.dtpRDate.Value; fix.mRemark = this.textFixRemark.Text; bool flag; if (updata_flag) { flag = FixMgr.MUpdate(ID, fix); if (flag) { untCommon.InfoMsg("修改成功。"); } else { untCommon.InfoMsg("修改失败。"); } } else { if (IsEqAvailable(this.textEqNO.Text)) { if (_power == "0" || _power == "1") { flag = FixMgr.AddWithoutVerify(fix); } else { flag = FixMgr.Add(fix); } flag = EqMgr.FixEq(fix.EqNo); if (flag) { untCommon.InfoMsg("送修成功。"); } else { untCommon.InfoMsg("送修失败。"); } } else { untCommon.InfoMsg("该资产状态已改变,无法修改该信息。"); } } this.DialogResult = DialogResult.OK; }