Пример #1
0
 private void toolDelete_Click(object sender, EventArgs e)
 {
     if (dgvUntreadRefundBill.RowCount == 0)
     {
         return;
     }
     if (GlobalProperty.OperatorCode != dgvUntreadRefundBill.CurrentRow.Cells["OperatorCode"].Value.ToString())
     {
         MessageBox.Show("非本记录的录入人员,不许允许删除!", "软件提示");
         return;
     }
     if (MessageBox.Show("确定要删除吗?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
     {
         RetailUntreadRefundBill rurb = new RetailUntreadRefundBill();
         DataGridViewRow         dgvr = dgvUntreadRefundBill.CurrentRow;
         int    intId  = Convert.ToInt32(dgvr.Cells["Id"].Value);
         String strSql = "Delete From UntreadRefundBill Where Id = " + intId;
         if (rurb.Delete(strSql))
         {
             dgvUntreadRefundBill.Rows.Remove(dgvr);
             MessageBox.Show("删除成功!", "软件提示");
         }
         else
         {
             MessageBox.Show("删除失败!", "软件提示");
         }
     }
 }
Пример #2
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            RetailUntreadRefundBill rurb = new RetailUntreadRefundBill();
            string strSql = null;

            if (!chbIsCDNo.Checked) //没有选中光盘号查询
            {
                if (!String.IsNullOrEmpty(txtCustomerName.Text.Trim()))
                {
                    strSql += " and CustomerName like '%" + txtCustomerName.Text.Trim() + "%'";
                }
                if (!(cbxProvinceCode.SelectedValue == null))
                {
                    strSql += " and ProvinceCode = '" + cbxProvinceCode.SelectedValue.ToString() + "'";
                }
                if (!String.IsNullOrEmpty(txtAddress.Text.Trim()))
                {
                    strSql += " and Address like '%" + txtAddress.Text.Trim() + "%'";
                }
                if (!String.IsNullOrEmpty(txtPhoneNumber.Text.Trim()))
                {
                    strSql += " and PhoneNumber like '%" + txtPhoneNumber.Text.Trim() + "%'";
                }
                if (!String.IsNullOrEmpty(txtUntreadBillNo.Text.Trim()))
                {
                    strSql += " and UntreadRefundBill.UntreadBillNo like '%" + txtUntreadBillNo.Text.Trim() + "%'";
                }
                if (!(cbxPayTypeCode.SelectedValue == null))
                {
                    strSql += " and UntreadRefundBill.PayTypeCode = '" + cbxPayTypeCode.SelectedValue.ToString() + "'";
                }
                if (!(cbxEmployeeCode3.SelectedValue == null))
                {
                    strSql += " and UntreadRefundBill.EmployeeCode3 = '" + cbxEmployeeCode3.SelectedValue.ToString() + "'";
                }
                if (dtpUntreadMoneyDate.Checked)
                {
                    strSql += " and UntreadRefundBill.UntreadMoneyDate = '" + dtpUntreadMoneyDate.Value.Date + "'";
                }
                if (dtpAppendDate.Checked)
                {
                    strSql += " and UntreadRefundBill.AppendDate = '" + dtpAppendDate.Value.Date + "'";
                }
                strSql = rurb.UntreadRefundBillSql + strSql;
            }
            if (chbIsCDNo.Checked) //选中光盘号查询
            {
                strSql = rurb.UntreadRefundBill_CDNo_Sql + " and UntreadCDRecord.CDNo = '" + txtCDNo.Text.Trim() + "'";
            }
            formRetailUntreadRefundBill.dgvUntreadRefundBill.DataSource = rurb.GetDataTable(strSql);
            this.Close();
        }