/// <summary>检查参数是否存在</summary> /// <param name="varname">参数名</param> /// <returns></returns> private bool IsExist(string varname) { string strSql = "select * from sysconfig where varname='" + varname + "'"; int iCount = StaticValue.SelectTable(strSql).Rows.Count; if (iCount == 0) { return(false); //不存在 } return(true); //存在 }
/// <summary>系统参数设置。</summary> /// <param name="varname">参数名</param> public SystemConfig(int index, string varname) { if (!this.IsExist(varname)) { this.Initialize(); this.Insert(index); } string strSql = "select * from sysconfig where varname='" + varname + "'"; DataRow objRow = StaticValue.SelectTable(strSql).Rows[0]; this.VarIndex = int.Parse(objRow["varindex"].ToString()); this.VarName = objRow["varname"].ToString(); this.VarType = objRow["vartype"].ToString(); this.VarValue = objRow["varvalue"].ToString(); this.VarInfo = objRow["varinfo"].ToString(); }
/// <summary>验证数据</summary> private bool ValidateData() { if (this.txtCode.Text.Trim() == "") { MessageBox.Show("消费单号不能为空,请输入!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtCode.Focus(); return(false); } if (new Pays().ExistsPayCode(this.txtCode.Text.Trim()) != "") { MessageBox.Show("消费单号【" + this.txtCode.Text.Trim() + "】已经存在,请重新输入!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtCode.Focus(); return(false); } if (this.txtClient.Text.Trim() != "" && StaticValue.ValidateMember(this.txtClient.Text.Trim()) == "") { MessageBox.Show("会员卡号不正确,该卡号不存在。", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtClient.Focus(); return(false); } if (this.txtClient.Text.Trim() != "" && new Member(this.txtClient.Text.Trim()).Status == 1) { MessageBox.Show("当前会员卡已停用,请重新指定。", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtClient.Focus(); return(false); } if (this.cboEmp1.SelectedIndex == 0 && this.cboEmp2.SelectedIndex == 0 && this.cboEmp3.SelectedIndex == 0) { MessageBox.Show("未指派服务人员!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.cboEmp1.Focus(); return(false); } if (this.dgvPayDetails.RowCount == 0) { MessageBox.Show("未选择消费项目!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.btnAdd.Focus(); return(false); } return(true); }
private void dgvPays_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { StaticValue.ShowRows_DataGridView_RowPostPaint(this.dgvPays, sender, e); }