private void fillSPD() { try { //"" = cboGlMc.SelectedValue.ToString(); //_modelFMD030.KHBH = txtDZ.Text.Trim(); this.fspdMc.ActiveSheet.Rows.Count = 0; string strWhere = " and SCQF='0'"; List <string> listFields = new List <string>(); listFields.Add(" ID,GYSMC,GYSSLMC,DZ,DH,LXR"); DataTable dtTable = DbHelperMySql.Query(DBHelper.getAllList(TableName, listFields, strWhere)).Tables[0]; if (dtTable.Rows.Count > 0) { for (int i = 0; i < dtTable.Rows.Count; i++) { this.fspdMc.ActiveSheet.Rows.Count++; //往spread里填充数据 this.fspdMc.ActiveSheet.SetValue(i, 0, dtTable.Rows[i]["GYSMC"].ToString()); this.fspdMc.ActiveSheet.SetValue(i, 1, dtTable.Rows[i]["GYSSLMC"].ToString()); this.fspdMc.ActiveSheet.SetValue(i, 2, dtTable.Rows[i]["DZ"].ToString()); this.fspdMc.ActiveSheet.SetValue(i, 3, dtTable.Rows[i]["DH"].ToString()); this.fspdMc.ActiveSheet.SetValue(i, 4, dtTable.Rows[i]["LXR"].ToString()); this.fspdMc.ActiveSheet.SetValue(i, 5, dtTable.Rows[i]["ID"].ToString()); } ComSpread.SpdSetFocus(fspdMc, 0, 0); fspdMc.ActiveSheet.Rows[0].BackColor = Color.Lavender; } else { return; } } catch (Exception ex) { ComForm.InsertErrLog(ex.Message, this.Text); } }
private void fspdMc_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e) { ComSpread.Spread_CellClickChangeBColor(fspdMc, e, Color.Lavender); }
private void fspdMc_LeaveCell(object sender, FarPoint.Win.Spread.LeaveCellEventArgs e) { ComSpread.Spread_LeaveCellBColor(fspdMc, e, Color.Lavender); }
//删除按钮 private void btnDelete_Click(object sender, EventArgs e) { //if (cboGlMc.Text.strReplace().IsNullOrEmpty()) //{ // ComForm.DspMsg("W002", "管理名称"); // cboGlMc.Focus(); // return; //} if (txtDZ.Text.strReplace().IsNullOrEmpty()) { ComForm.DspMsg("W002", "客户编号"); txtDZ.Focus(); return; } //判断名称KEY 是否存在 bool chkMckey = false; for (int i = 0; i < fspdMc.ActiveSheet.Rows.Count; i++) { if (txtDZ.Text.Equals(ComSpread.SpdGetValue(fspdMc, i, 0))) { chkMckey = true; break; } } //判断名称KEY 是否存在,不存在不做删除操作 //if (chkMckey == false) //{ // ComForm.DspMsg("W063", "客户编号"); // txtDZ.Focus(); // return; //} //chkMckey = false; //for (int i = 0; i < fspdMc.ActiveSheet.Rows.Count; i++) //{ // if (txtZsMc.Text.Equals(ComSpread.SpdGetValue(fspdMc, i, 1))) // { // chkMckey = true; // break; // } //} //判断名称KEY 是否存在,不存在不做删除操作 if (chkMckey == false) { ComForm.DspMsg("W063", "客户名称"); txtGYSMC.Focus(); return; } if (Const.LING == ComForm.DspMsg("Q003", "")) { try { //_modelFMD030.KHBH = txtDZ.Text.strReplace(); //_modelFMD030.KHMC = txtZsMc.Text.strReplace(); //_bllFMD030.Delete(_modelFMD030.KHBH, ""); ComForm.DspMsg("M001", ""); txtDZ.Focus(); } catch (Exception ew) { ComForm.DspMsg("E001", ""); return; } txtDZ.Text = string.Empty; txtGYSSLMC.Text = string.Empty; txtGYSMC.Text = string.Empty; fillSPD(); } }