Ejemplo n.º 1
0
        private void sbtnRead_Click(object sender, System.EventArgs e)
        {
            string strresult = "";

            lblerr.Visible = false;
            chs            = cs.ReadCardInfo(out strresult);
            if (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK))
            {
                if (strresult == CardCommon.CardDef.ConstMsg.RFAUTHENTICATION_A_ERR)
                {
                    MessageBox.Show("该卡不属于本系统使用的卡,请检查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
                MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (strresult != null || strresult != "")
                {
                    clog.WriteLine(strresult);
                }
                return;
            }
            if (chs.strCardID == "")
            {
                MessageBox.Show("会员卡号不正确,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

            err = null;
            CMSMStruct.MemberStruct mebres = new CMSMStruct.MemberStruct();
            string strDeptNameTmp          = CMSMData.CMSMDataAccess.SysInitial.LocalDeptNameTmp;

            mebres = cs.GetMemberDetail(chs.strCardID, strDeptNameTmp, out err);
            if (mebres != null)
            {
                txtCardID.Text      = mebres.strCardID;
                txtCompName.Text    = mebres.strCompanyName;
                txtLicenseTag.Text  = mebres.strLicenseTag;
                txtCharge.Text      = chs.dCurCharge.ToString();
                txtCardID.ReadOnly  = true;
                sbtnFill.Enabled    = true;
                sbtnRead.Enabled    = false;
                txtFillFee.ReadOnly = false;
                txtFillFee.Focus();
            }
            else
            {
                MessageBox.Show("无此会员或已经失效,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null)
                {
                    clog.WriteLine(err);
                }
            }
        }
Ejemplo n.º 2
0
        private void sbtnOk_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.MemberStruct mebNew = new CMSMStruct.MemberStruct();
            if (txtCardID.Text.Trim() == "" || txtCardID.Text.Trim().Length > 5)
            {
                MessageBox.Show("会员卡号不可为空且等于5位,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtCardID.Focus();
                return;
            }

            if (cmbCompName.Text.Trim() == "" || cmbCompName.Text.Trim().Length > 30)
            {
                MessageBox.Show("单位名称不可为空且小于30个汉字,请重新填写单位名称!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                mebNew.strCompanyName = cmbCompName.Text.Trim();
            }

            if (txtLicenseTag.Text.Trim() != "" && txtLicenseTag.Text.Trim().Length > 20)
            {
                MessageBox.Show("车牌号不可为空且小于20个字符,请重新填写车牌号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtLicenseTag.Focus();
                return;
            }
            else
            {
                mebNew.strLicenseTag = txtLicenseTag.Text.Trim();
            }

            mebNew.strCompanyName = cmbCompName.Text.Trim();
            mebNew.strLicenseTag  = txtLicenseTag.Text.Trim();
            mebNew.strGoodsName   = cmbGoodsName.Text.Trim();
            mebNew.strGoodsType   = cmbGoodsType.Text.Trim();
            mebNew.strComments    = txtComments.Text.Trim();
            mebNew.strOperName    = SysInitial.CurOps.strOperName;
            mebNew.strOperDate    = System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToLongTimeString();

            err = null;
            cs.UpdateMember(mebNew, mebOld, out err);
            if (err != null)
            {
                MessageBox.Show("修改会员资料失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err);
            }
            else
            {
                MessageBox.Show("修改会员资料成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.Close();
            }
        }
Ejemplo n.º 3
0
        private void sbtnOk_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.MemberStruct meb1 = new CMSMStruct.MemberStruct();
            if (txtCardID.Text.Trim() == "" || txtCardID.Text.Trim().Length != 5)
            {
                MessageBox.Show("会员卡号不可为空且为5位,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtCardID.Focus();
                return;
            }
            else if (!cs.ChkCardIDDup(txtCardID.Text.Trim(), out err))
            {
                meb1.strCardID = txtCardID.Text.Trim();
            }
            else
            {
                if (err == null)
                {
                    MessageBox.Show("该卡已经有其他会员使用,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    txtCardID.Focus();
                    return;
                }
                else
                {
                    MessageBox.Show("检查卡号错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    clog.WriteLine(err);
                    return;
                }
            }

            if (cmbCompName.Text.Trim() == "")
            {
                MessageBox.Show("无单位信息,请先录入单位信息!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                meb1.strCompanyName = cmbCompName.Text.Trim();
            }

            CMSMStruct.CompDeptStruct compdept = this.GetComDeptByCompName(meb1.strCompanyName);
            meb1.strCompanyID = compdept.strCompanyID;
            meb1.strDeptID    = compdept.strDeptID;
            meb1.strDeptName  = compdept.strDeptName;
            if (meb1.strDeptName == "" || meb1.strDeptID == "")
            {
                MessageBox.Show("部门参数不正确!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

            if (txtLicenseTag.Text.Trim() != "" && txtLicenseTag.Text.Trim().Length > 20)
            {
                MessageBox.Show("车牌号不可为空且小于20个字符,请重新填写车牌号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtLicenseTag.Focus();
                return;
            }
            else
            {
                meb1.strLicenseTag = txtLicenseTag.Text.Trim();
            }

            meb1.strGoodsName  = cmbGoodsName.Text.Trim();
            meb1.strGoodsType  = cmbGoodsType.Text.Trim();
            meb1.strState      = "0";
            meb1.strComments   = txtComments.Text.Trim();
            meb1.strCreateDate = System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToLongTimeString();
            meb1.strOperName   = SysInitial.CurOps.strOperName;
            meb1.strOperDate   = meb1.strCreateDate;

            err = null;
            string strresult = cs.InsertMember(meb1, out err);

            if (err != null || (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK)))
            {
                MessageBox.Show("添加新会员失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null && strresult != null)
                {
                    clog.WriteLine(err.Message + "\n" + strresult);
                }
                else if (err != null)
                {
                    clog.WriteLine(err);
                }
                else
                {
                    clog.WriteLine(strresult);
                }
            }
            else
            {
                MessageBox.Show("添加新会员成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.txtCardID.Text     = "";
                this.txtLicenseTag.Text = "";
                this.txtComments.Text   = "";
            }
        }