Ejemplo n.º 1
0
        public bool UserParseLine(string strValue, string strSplit, out CMSMStruct.AssociatorStruct asstmp, out Exception err)
        {
            int i = 0;

            asstmp = new CMSMData.CMSMStruct.AssociatorStruct();
            err    = null;
            try
            {
                string[] strFields = strValue.Split(strSplit.ToCharArray());
                asstmp.strAssID       = strFields[i++];
                asstmp.strCardID      = strFields[i++];
                asstmp.strAssName     = strFields[i++];
                asstmp.strSpell       = strFields[i++];
                asstmp.strAssNbr      = strFields[i++];
                asstmp.strLinkPhone   = strFields[i++];
                asstmp.strLinkAddress = strFields[i++];
                asstmp.strEmail       = strFields[i++];
                asstmp.strAssType     = strFields[i++];
                asstmp.strAssState    = strFields[i++];
                asstmp.dCharge        = double.Parse(strFields[i++]);
                asstmp.iIgValue       = int.Parse(strFields[i++]);
                asstmp.strCardFlag    = strFields[i++];
                asstmp.strComments    = strFields[i++];
                asstmp.strCreateDate  = strFields[i++];
                asstmp.strOperDate    = strFields[i++];
                asstmp.strDeptID      = strFields[i++];
            }
            catch (Exception e)
            {
                err = e;
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
 private void txtCardID_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         string strCardID = txtCardID.Text.Trim();
         if (strCardID == "0")
         {
             txtName.Text  = "";
             txtphone.Text = "";
         }
         else
         {
             Exception err = null;
             CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
             assres = cs.GetAssociatorName(strCardID, out err);
             if (assres == null || err != null)
             {
                 txtName.Text  = assres.strAssName;
                 txtphone.Text = assres.strLinkPhone;
             }
             else
             {
                 txtName.Text  = "";
                 txtphone.Text = "";
             }
         }
     }
 }
Ejemplo n.º 3
0
        private void frmSpecialCons_Load(object sender, System.EventArgs e)
        {
            cmbGoodsName.Text     = "请输入...";
            txtTolCount.ReadOnly  = true;
            txtTolCharge.ReadOnly = true;
            txtBalance.ReadOnly   = true;
            txtGoodsID.ReadOnly   = true;
            txtPay.ReadOnly       = true;
            txtPrice.ReadOnly     = true;

            this.label15.Visible = false;
            this.label17.Visible = false;
            this.txtPay.Visible  = false;

            this.txtAssID.Visible  = false;
            this.txtCardID.Visible = false;

            txtCount.Text   = "1";
            txtPay.Text     = "0";
            txtBalance.Text = "0";
            txtPrice.Text   = "0";

            groupBox3.BackColor = Color.Snow;

            this.cmbSepcialType.Items.Add("门店报损");
            this.cmbSepcialType.Items.Add("门店品尝");
            this.cmbSepcialType.Items.Add("门店退货");
            this.cmbSepcialType.SelectedIndex = 0;
            SpecTypeIndex = -10;

            err = null;
            CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
            assres = cs.GetAssociatorName("VMaster", out err);
            if (assres != null)
            {
                txtCardID.Text = assres.strCardID;
                txtAssID.Text  = assres.strAssID;
            }
            else
            {
                MessageBox.Show("无门店特殊客户,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null)
                {
                    clog.WriteLine(err);
                }
                return;
            }

            dtConsItem = new DataTable();
            dtConsItem.Columns.Add("GoodsID");
            dtConsItem.Columns.Add("GoodsName");
            dtConsItem.Columns.Add("Price");
            dtConsItem.Columns.Add("Count");
            dtConsItem.Columns.Add("Rate");
            dtConsItem.Columns.Add("Fee");
            dtConsItem.Columns.Add("Comments");
            dtConsItem.Columns["Comments"].DefaultValue = "";
            DgBind();
        }
Ejemplo n.º 4
0
        private void txtCardID_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar != 13)
            {
//				if(e.KeyChar==8||e.KeyChar==42)
//				{
//					return;
//				}
//				if(e.KeyChar<48||e.KeyChar>57)
//				{
//					e.Handled=true;
//					return;
//				}
            }
            else
            {
                Ping      ping = new Ping();
                PingReply pr   = ping.Send("10.10.10.203");
                if (pr.Status != IPStatus.Success)
                {
                    MessageBox.Show("童鞋!vpn掉线了或者网速太慢!,请检查vpn连接!");
                    return;
                }

                err = null;
                string strCardID = txtCardID.Text.Trim();
                if (strCardID == "")
                {
                    MessageBox.Show("会员卡号不可为空,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
                CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
                assres = cs.GetAssociatorRelease(strCardID, out err);
                if (assres != null)
                {
                    string strAssState = assres.strAssState;
                    if (strAssState != "1")
                    {
                        MessageBox.Show("该会员非挂失会员,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    txtAssID.Text       = assres.strAssID;
                    txtAssName.Text     = assres.strAssName;
                    txtLinkPhone.Text   = assres.strLinkPhone;
                    txtCharge.Text      = assres.dCharge.ToString();
                    txtCardID.ReadOnly  = true;
                    sbtnRelease.Enabled = true;
                }
                else
                {
                    MessageBox.Show("你输入的会员卡有误或者不是正常在用会员!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    if (err != null)
                    {
                        clog.WriteLine(err);
                    }
                    return;
                }
            }
        }
Ejemplo n.º 5
0
        private void sbtnRead_Click(object sender, System.EventArgs e)
        {
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

            if (pr.Status != IPStatus.Success)
            {
                MessageBox.Show("童鞋,补充值失败!vpn掉线了或者网速太慢!,请检查vpn连接!");
                return;
            }

            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;
                }
                if (strresult != "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (strresult != null)
                {
                    clog.WriteLine(strresult);
                }
                return;
            }
            if (chs.strCardID == "")
            {
                MessageBox.Show("会员卡号不正确,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else if (chs.strCardID.Substring(0, 1) == "F")
            {
                MessageBox.Show("此卡为员工卡,不可进行消费!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                err = null;
                CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
                assres = cs.GetAssociatorName(chs.strCardID, out err);
                if (assres != null)
                {
                    string strAssState = assres.strAssState;
                    if (strAssState != "0")
                    {
                        MessageBox.Show("该会员已经失效,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    if (chs.dCurCharge == -1)
                    {
                        chs.dCurCharge = assres.dCharge;
                    }
                    if (chs.iCurIg == -1)
                    {
                        chs.iCurIg = assres.iIgValue;
                    }
                    txtAssID.Text       = assres.strAssID;
                    txtCardID.Text      = assres.strCardID;
                    txtAssName.Text     = assres.strAssName;
                    txtLinkPhone.Text   = assres.strLinkPhone;
                    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.º 6
0
        private void sbtnOk_Click(object sender, System.EventArgs e)
        {
            CMSMStruct.AssociatorStruct ass1 = new CMSMData.CMSMStruct.AssociatorStruct();
//			if(txtCardID.Text.Trim()==""||txtCardID.Text.Trim().Length!=int.Parse(SysInitial.Card))
            if (txtCardID.Text.Trim() == "" || txtCardID.Text.Trim().Length != 5)
            {
                if (txtCardID.Text.Trim().Length != int.Parse(SysInitial.Card))
                {
                    MessageBox.Show("会员卡号不可为空或者位数不对,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    txtCardID.Focus();
                    return;
                }
            }
            else
            {
                ass1.strCardID = txtCardID.Text.Trim();
            }

            if (txtAssName.Text.Trim() == "" || txtAssName.Text.Trim().Length > 30)
            {
                MessageBox.Show("会员姓名不可为空且小于15个字,请重新填写会员姓名!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtAssName.Focus();
                return;
            }
            else
            {
                ass1.strAssName = txtAssName.Text.Trim();
            }

            if (txtAssNbr.Text.Trim() != "" && txtAssNbr.Text.Trim().Length != 15 && txtAssNbr.Text.Trim().Length != 18)
            {
                MessageBox.Show("身份证号应为15或18位,请重新填写身份证号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtAssNbr.Focus();
                return;
            }
            else
            {
                ass1.strAssNbr = txtAssNbr.Text.Trim();
            }

            if (txtLinkPhone.Text.Trim() == "" || txtLinkPhone.Text.Trim().Length > 25)
            {
                MessageBox.Show("联系电话不可为空且小于25位,请重新填写联系电话!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtLinkPhone.Focus();
                return;
            }
            else
            {
                ass1.strLinkPhone = txtLinkPhone.Text.Trim();
            }

            ass1.strLinkAddress = txtLinkAddress.Text.Trim();
            ass1.strSpell       = txtSpell.Text.Trim().ToLower();
            ass1.strEmail       = txtEmail.Text.Trim();
            ass1.strAssState    = "0";
            ass1.strComments    = txtComments.Text.Trim();
            DateTime dtNow = DateTime.Now;

            ass1.striSerial  = dtNow.ToString("yyyyMMddHHmmss");
            ass1.strOperDate = dtNow.ToShortDateString() + " " + dtNow.ToLongTimeString();
            //ass1.striSerial = ass1.strOperDate.Substring(0, 4) + ass1.strOperDate.Substring(5, 2) + ass1.strOperDate.Substring(8, 2) + ass1.strOperDate.Substring(11, 2) + ass1.strOperDate.Substring(14, 2) + ass1.strOperDate.Substring(17, 2);

            string strAssType = cmbAssType.Text.Trim();

            ass1.strAssType   = GetColEn(strAssType, "AT");
            assOld.strAssType = GetColEn(assOld.strAssType, "AT");

            err = null;
            cs.UpdateAssociator(ass1, assOld, 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.º 7
0
        private void btnRead_Click(object sender, System.EventArgs e)
        {
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

            if (pr.Status != IPStatus.Success)
            {
                MessageBox.Show("童鞋,刷卡失败!vpn掉线了或者网速太慢!,请检查vpn连接!");
                return;
            }

            string strresult = "";

            CMSMStruct.CardHardStruct 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;
                }
                if (strresult != "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (strresult != null)
                {
                    clog.WriteLine(strresult);
                }
                return;
            }
            if (chs.strCardID == "")
            {
                MessageBox.Show("会员卡号不正确,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else if (chs.strCardID.Substring(0, 1) == "F")
            {
                MessageBox.Show("此卡为员工卡,不可进行消费撤消!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                err = null;
                CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
                assres = cs.GetAssociatorName(chs.strCardID, out err);
                if (assres != null)
                {
                    string strAssState = assres.strAssState;
                    if (strAssState != "0")
                    {
                        MessageBox.Show("该会员已经失效,卡号:" + chs.strCardID + ",请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }

                    err = null;
                    DataSet dsout = cs.GetAssConsLast(assres.strCardID, out err);
                    if (dsout == null || err != null)
                    {
                        MessageBox.Show(err.Message, "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
#if !DEBUG
                        if (chs.dCurCharge != Math.Round(double.Parse(dsout.Tables["CurCharge"].Rows[0]["nFeeCur"].ToString()), 2))
                        {
                            MessageBox.Show("会员卡上当前余额与上次消费后余额不相符,不能撤消!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                            return;
                        }
                        else
                        {
#endif
                        txtAssID.Text     = assres.strAssID;
                        txtCurCharge.Text = chs.dCurCharge.ToString();
                        txtCardID.Text    = assres.strCardID;
                        txtAssName.Text   = assres.strAssName;

                        this.txtBillNo.Text   = dsout.Tables["Bill"].Rows[0]["iSerial"].ToString();
                        this.txtConsFee.Text  = dsout.Tables["Bill"].Rows[0]["nPay"].ToString();
                        this.txtConsDate.Text = dsout.Tables["Bill"].Rows[0]["dtTime"].ToString();

                        this.dataGrid1.SetDataBinding(dsout.Tables["ConsItem"], "");
                        this.EnToCh("商品编号,商品名称,单价,数量,折扣金额,实收金额", "80,130,70,50,60,70", dsout.Tables["ConsItem"], this.dataGrid1);

                        btnRead.Enabled        = false;
                        this.btnRemove.Enabled = true;
#if !DEBUG
                    }
#endif
                    }
                }
                else
                {
                    MessageBox.Show("无会员资料,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    if (err != null)
                    {
                        clog.WriteLine(err);
                    }
                    return;
                }
            }
        }
Ejemplo n.º 8
0
//		private void txtCardID_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
//		{
//			if(e.KeyChar==8)
//			{
//				return;
//			}
//			if(e.KeyChar<48||e.KeyChar>57)
//			{
//				e.Handled=true;
//			}
//		}

        private void sbtnOk_Click(object sender, System.EventArgs e)
        {
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

            if (pr.Status != IPStatus.Success)
            {
                MessageBox.Show("童鞋,发卡失败!vpn掉线了或者网速太慢!,请检查vpn连接!");
                return;
            }

            CMSMStruct.AssociatorStruct ass1 = new CMSMData.CMSMStruct.AssociatorStruct();
            if (txtCardID.Text.Trim() == "" || txtCardID.Text.Trim().Length != int.Parse(SysInitial.Card))
            {
                MessageBox.Show("会员卡号不可为空或者位数不对,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtCardID.Focus();
                return;
            }
            else if (!cs.ChkCardIDDup(txtCardID.Text.Trim(), out err))
            {
                ass1.strCardID = txtCardID.Text.Trim();
            }
            else
            {
                MessageBox.Show("该卡已经有其他会员使用,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtCardID.Focus();
                return;
            }

            if (txtAssName.Text.Trim() == "" || txtAssName.Text.Trim().Length > 30)
            {
                MessageBox.Show("会员姓名不可为空且小于15个字,请重新填写会员姓名!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtAssName.Focus();
                return;
            }
            else
            {
                ass1.strAssName = txtAssName.Text.Trim();
            }

            if (txtAssNbr.Text.Trim() != "" && txtAssNbr.Text.Trim().Length != 15 && txtAssNbr.Text.Trim().Length != 18)
            {
                MessageBox.Show("身份证号应为15或18位,请重新填写身份证号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtAssNbr.Focus();
                return;
            }
            else
            {
                ass1.strAssNbr = txtAssNbr.Text.Trim();
            }

            if (txtLinkPhone.Text.Trim() == "" || txtLinkPhone.Text.Trim().Length > 25)
            {
                MessageBox.Show("联系电话不可为空且小于25位,请重新填写联系电话!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtLinkPhone.Focus();
                return;
            }
            else
            {
                ass1.strLinkPhone = txtLinkPhone.Text.Trim();
            }
//			CardCommon.CardRef.CardM1 cm = new CardCommon.CardRef.CardM1(SysInitial.intCom);
//			cm.ReadCardSnr("");
            ass1.strSpell       = txtSpell.Text.Trim().ToLower();
            ass1.strLinkAddress = txtLinkAddress.Text.Trim();
            ass1.strEmail       = txtEmail.Text.Trim();
            ass1.strAssState    = "0";
            ass1.dCharge        = 0;
            ass1.iIgValue       = 0;
            ass1.strCardFlag    = "1";
            ass1.strComments    = txtComments.Text.Trim();
            DateTime dtNow = DateTime.Now;

            ass1.striSerial    = dtNow.ToString("yyyyMMddHHmmss");
            ass1.strCreateDate = dtNow.ToShortDateString() + " " + dtNow.ToLongTimeString();
            //ass1.striSerial = ass1.strCreateDate.Substring(0, 4) + ass1.strCreateDate.Substring(5, 2) + ass1.strCreateDate.Substring(8, 2) + ass1.strCreateDate.Substring(11, 2) + ass1.strCreateDate.Substring(14, 2) + ass1.strCreateDate.Substring(17, 2);
            ass1.strOperDate = ass1.strCreateDate;
            ass1.strDeptID   = SysInitial.CurOps.strDeptID;

            string strAssType = cmbAssType.Text.Trim();

            ass1.strAssType = GetColEn(strAssType, "AT");

            err = null;
            string strresult = cs.InsertAssociator(ass1, out err);

            if (err != null || (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK)))
            {
                if (strresult != "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("添加新会员失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null || strresult != null)
                {
                    clog.WriteLine(err + "\n" + strresult);
                }
            }
            else
            {
                MessageBox.Show("添加新会员成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.ClearText();
            }
        }
Ejemplo n.º 9
0
        private void sbtnOk_Click(object sender, System.EventArgs e)
        {
            this.progressBarControl1.Position = 0;
            this.listBox1.Items.Clear();
            string filePath = @"E:\\BreadWorksDataBak\\UpLoad\\";
            string UpFileName;

            if (!System.IO.Directory.Exists(filePath))
            {
                System.IO.Directory.CreateDirectory(filePath);
                MessageBox.Show("没有需要上传的资料!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string[] fileall = Directory.GetFiles(filePath);
            if (fileall.Length == 0)
            {
                MessageBox.Show("没有需要上传的资料!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DataTable dtmd = SysInitial.dsSys.Tables["MD"];
            string    strZZ;
            bool      fileflag = false;

            for (int i = 0; i < dtmd.Rows.Count; i++)
            {
                if (dtmd.Rows[i]["vcCommCode"].ToString() != SysInitial.LocalDept)
                {
                    fileflag = false;
                    strZZ    = dtmd.Rows[i]["vcCommCode"].ToString() + ".L00$";
                    Regex regExpr = new Regex(strZZ.ToLower());
                    foreach (string _strFileName in fileall)
                    {
                        FileInfo fileInfo = new FileInfo(_strFileName);

                        if (regExpr.IsMatch(fileInfo.Name.ToLower(), 0))
                        {
                            fileflag = true;
                            break;
                        }
                    }
                }
                if (fileflag)
                {
                    break;
                }
            }
            if (!fileflag)
            {
                MessageBox.Show("没有需要上传的资料!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            for (int i = 0; i < dtmd.Rows.Count; i++)
            {
                if (dtmd.Rows[i]["vcCommCode"].ToString() != SysInitial.LocalDept)
                {
                    fileflag = false;
                    strZZ    = dtmd.Rows[i]["vcCommCode"].ToString() + ".L00$";
                    Regex regExpr = new Regex(strZZ.ToLower());
                    foreach (string _strFileName in fileall)
                    {
                        FileInfo fileInfo = new FileInfo(_strFileName);

                        if (regExpr.IsMatch(fileInfo.Name.ToLower(), 0))
                        {
                            fileflag = true;
                            break;
                        }
                    }
                    if (!fileflag)
                    {
                        continue;
                    }

                    this.listBox1.Items.Add("开始上传" + dtmd.Rows[i]["vcCommName"].ToString() + "的数据:");
                    this.listBox1.Items.Add("---------------------------");
                    this.Refresh();
                    UpFileName = "down" + dtmd.Rows[i]["vcCommCode"].ToString() + ".L00";
                    if (System.IO.File.Exists(filePath + UpFileName + ".tmp"))
                    {
                        System.IO.File.Delete(filePath + UpFileName + ".tmp");
                    }
                    ArrayList alUp = new ArrayList();

                    StreamReader fReader;
                    string       strLine;
                    string       strTitle = "";
                    string       strUpFlag;
                    string       strFlag = "NO";
//					int upcount=0;
//					int reTolCount=0;
//					int unitcount=0;
//					int curcount=0;

                    if (System.IO.File.Exists(filePath + UpFileName))
                    {
                        //解密
                        DESEncryptor dese = new DESEncryptor();
                        dese.InputFilePath = filePath + UpFileName;
                        dese.OutFilePath   = filePath + UpFileName + ".tmp";
                        dese.DecryptKey    = "cmsmyykx";
                        dese.FileDesDecrypt();
                        if (dese.NoteMessage != null)
                        {
                            MessageBox.Show("上传文件处理出错,请重试!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.clog.WriteLine(dese.NoteMessage);
                            return;
                        }
                        dese = null;

                        err = null;
                        ca.TruncateDataTmp(out err);

                        fReader = new StreamReader(filePath + UpFileName + ".tmp");
                        while ((strLine = fReader.ReadLine()) != null)
                        {
                            strUpFlag = "";
                            strFlag   = "NO";
                            if (strLine.Trim().Length <= 0)
                            {
                                continue;
                            }

                            //是否单表结束
                            strUpFlag = strLine.Substring(0, 3);
                            if (strUpFlag == "END")
                            {
//								switch(strTitle)
//								{
//									case "USERTOL":
//										this.listBox1.Items.Add("会员资料上传完成,本次上传会员数:" + upcount.ToString());
//										break;
//									case "ALTETOL":
//										this.listBox1.Items.Add("会员资料变更记录上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									case "CONSTOL":
//										this.listBox1.Items.Add("消费明细上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									case "INVOTOL":
//										this.listBox1.Items.Add("小票数据上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									case "INTGTOL":
//										this.listBox1.Items.Add("积分日志上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									case "FILLTOL":
//										this.listBox1.Items.Add("充值日志上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									case "BUSSTOL":
//										this.listBox1.Items.Add("营业日志上传完成,本次上传记录数:" + upcount.ToString());
//										break;
//									default:
//										break;
//								}
                                if (strTitle == "USERTOL" && !SysInitial.MainDept)
                                {
                                    break;
                                }
                                strTitle = "";
//								upcount=0;
//								curcount=0;
                                continue;
                            }

                            //是否单表开始
                            strUpFlag = strLine.Substring(4, 3);
                            if (strUpFlag == "TOL")
                            {
                                strTitle = strLine.Substring(0, 7);
//								reTolCount=int.Parse(strLine.Substring(8,strLine.Length-8));
//								this.progressBarControl1.Position=0;
//								unitcount=reTolCount/40;
                                continue;
                            }

                            //根据上传表名进行上传
                            switch (strTitle)
                            {
                            case "USERTOL":
                                #region   会员资料
                                CMSMStruct.AssociatorStruct ass = new CMSMData.CMSMStruct.AssociatorStruct();
                                err = null;
                                if (!sts.UserParseLine(strLine, ",", out ass, out err))
                                {
                                    MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    if (err != null)
                                    {
                                        clog.WriteLine(err);
                                    }
                                    continue;
                                }
                                err = null;
                                if (!ca.UpAssData(ass, out strFlag, out err))
                                {
                                    MessageBox.Show("上传数据出错,卡号:" + ass.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    if (err != null)
                                    {
                                        clog.WriteLine(err);
                                    }
                                    continue;
                                }
//									if(strFlag=="YES")
//										upcount++;
//									curcount++;
//									if(curcount<reTolCount)
//									{
//										if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//										{
//											this.progressBarControl1.Position++;
//											this.Refresh();
//										}
//									}
//									else
//									{
//										this.progressBarControl1.Position=40;
//										this.Refresh();
//									}
                                #endregion
                                break;

                            case "ALTETOL":
//									#region 上传会员资料变更记录
//									CMSMStruct.AssChangeStruct asschange=new CMSMData.CMSMStruct.AssChangeStruct();
//									err=null;
//									if(!sts.UserAlterParseLine(strLine,",",out asschange,out err))
//									{
//										MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!","系统提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
//										if(err!=null)
//										{
//											clog.WriteLine(err);
//										}
//										continue;
//									}
//									err=null;
//									if(!ca.UpAssAlterData(asschange,out strFlag,out err))
//									{
//										MessageBox.Show("上传数据出错,卡号:" + asschange.strCardID + " !","系统提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
//										if(err!=null)
//										{
//											clog.WriteLine(err);
//										}
//										continue;
//									}
//									if(strFlag=="YES")
//										upcount++;
//									curcount++;
//									if(curcount<reTolCount)
//									{
//										if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//										{
//											this.progressBarControl1.Position++;
//											this.Refresh();
//										}
//									}
//									else
//									{
//										this.progressBarControl1.Position=40;
//										this.Refresh();
//									}
//									#endregion
                                break;

                            case "CONSTOL":
                                #region   消费明细
                                if (SysInitial.MainDept)
                                {
                                    CMSMStruct.ConsDownStruct consd = new CMSMData.CMSMStruct.ConsDownStruct();
                                    err = null;
                                    if (!sts.ConsParseLine(strLine, ",", out consd, out err))
                                    {
                                        MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
                                    err = null;
                                    if (!ca.UpConsData(consd, out strFlag, out err))
                                    {
                                        MessageBox.Show("上传数据出错,卡号:" + consd.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
//										if(strFlag=="YES")
//											upcount++;
//										curcount++;
//										if(curcount<reTolCount)
//										{
//											if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//											{
//												this.progressBarControl1.Position++;
//												this.Refresh();
//											}
//										}
//										else
//										{
//											this.progressBarControl1.Position=40;
//											this.Refresh();
//										}
                                }
                                #endregion
                                break;

                            case "INVOTOL":
                                #region   小票数据
                                if (SysInitial.MainDept)
                                {
                                    CMSMStruct.BillStruct bis = new CMSMData.CMSMStruct.BillStruct();
                                    err = null;
                                    if (!sts.BillParseLine(strLine, ",", out bis, out err))
                                    {
                                        MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
                                    err = null;
                                    if (!ca.UpBillData(bis, out strFlag, out err))
                                    {
                                        MessageBox.Show("上传数据出错,卡号:" + bis.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
//										if(strFlag=="YES")
//											upcount++;
//										curcount++;
//										if(curcount<reTolCount)
//										{
//											if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//											{
//												this.progressBarControl1.Position++;
//												this.Refresh();
//											}
//										}
//										else
//										{
//											this.progressBarControl1.Position=40;
//											this.Refresh();
//										}
                                }
                                #endregion
                                break;

                            case "INTGTOL":
                                #region   积分日志数据
                                if (SysInitial.MainDept)
                                {
                                    CMSMStruct.IntegralStruct its = new CMSMData.CMSMStruct.IntegralStruct();
                                    err = null;
                                    if (!sts.IntegralParseLine(strLine, ",", out its, out err))
                                    {
                                        MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
                                    err = null;
                                    if (!ca.UpIntegralData(its, out strFlag, out err))
                                    {
                                        MessageBox.Show("上传数据出错,卡号:" + its.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
//										if(strFlag=="YES")
//											upcount++;
//										curcount++;
//										if(curcount<reTolCount)
//										{
//											if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//											{
//												this.progressBarControl1.Position++;
//												this.Refresh();
//											}
//										}
//										else
//										{
//											this.progressBarControl1.Position=40;
//											this.Refresh();
//										}
                                }
                                #endregion
                                break;

                            case "FILLTOL":
                                #region   充值日志数据
                                if (SysInitial.MainDept)
                                {
                                    CMSMStruct.FillFeeStruct ffs = new CMSMData.CMSMStruct.FillFeeStruct();
                                    err = null;
                                    if (!sts.FillParseLine(strLine, ",", out ffs, out err))
                                    {
                                        MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
                                    err = null;
                                    if (!ca.UpFillData(ffs, out strFlag, out err))
                                    {
                                        MessageBox.Show("上传数据出错,卡号:" + ffs.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
//										if(strFlag=="YES")
//											upcount++;
//										curcount++;
//										if(curcount<reTolCount)
//										{
//											if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//											{
//												this.progressBarControl1.Position++;
//												this.Refresh();
//											}
//										}
//										else
//										{
//											this.progressBarControl1.Position=40;
//											this.Refresh();
//										}
                                }
                                #endregion
                                break;

                            case "BUSSTOL":
                                #region   营业日志
                                if (SysInitial.MainDept)
                                {
                                    CMSMStruct.BusiLogStruct blogs = new CMSMData.CMSMStruct.BusiLogStruct();
                                    err = null;
                                    if (!sts.BusiLogParseLine(strLine, ",", out blogs, out err))
                                    {
                                        MessageBox.Show("转换上传资料时出错,系统将自动跳过该条资料,继续上传!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
                                    err = null;
                                    if (!ca.UpBusiLogData(blogs, out strFlag, out err))
                                    {
                                        MessageBox.Show("上传数据出错,卡号:" + blogs.strCardID + " !", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        if (err != null)
                                        {
                                            clog.WriteLine(err);
                                        }
                                        continue;
                                    }
//										if(strFlag=="YES")
//											upcount++;
//										curcount++;
//										if(curcount<reTolCount)
//										{
//											if(curcount==(this.progressBarControl1.Position+1)*unitcount)
//											{
//												this.progressBarControl1.Position++;
//												this.Refresh();
//											}
//										}
//										else
//										{
//											this.progressBarControl1.Position=40;
//											this.Refresh();
//										}
                                }
                                #endregion
                                break;
                            }
                        }
                        fReader.Close();

                        err = null;
                        if (SysInitial.MainDept)
                        {
                            //在总店上传分店数据,包括会员资料,消费,营业日志等等
                            ca.UpAllData(filePath, UpFileName, out err);
                        }
                        else
                        {
                            //在分店上传其它店数据,只上传会员资料
                            ca.UpOtherDeptData(filePath, UpFileName, out err);
                        }

                        System.IO.File.Delete(filePath + UpFileName + ".tmp");
                    }
                    if (err != null)
                    {
                        this.listBox1.Items.Add("上传数据失败,请重试!");
                        this.listBox1.Items.Add(err.ToString());
                        return;
                    }

                    if (System.IO.File.Exists(filePath + UpFileName))
                    {
                        System.IO.File.Delete(filePath + UpFileName);
                    }
                    this.listBox1.Items.Add("\n");
                    this.listBox1.Items.Add("上传数据完成!");
                    this.listBox1.Items.Add("\n");
                    this.listBox1.Items.Add("\n");
                    this.Refresh();
                }
            }
        }
Ejemplo n.º 10
0
        private void sbtnRead_Click(object sender, System.EventArgs e)
        {
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

            if (pr.Status != IPStatus.Success)
            {
                MessageBox.Show("童鞋!VPN掉线了或者网速太慢,请检查vpn连接!");
                return;
            }

            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;
                }
                if (strresult != "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (strresult != null)
                {
                    clog.WriteLine(strresult);
                }
                return;
            }
            string aaccc = chs.strCardID;

//			chs.strCardID="GY000011";
            if (chs.strCardID == "")
            {
                MessageBox.Show("会员卡号不正确,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else if (chs.strCardID.Substring(0, 1) == "F")
            {
                MessageBox.Show("此卡为员工卡,不可进行充值!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                err = null;
                CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
                assres = cs.GetAssociatorName(chs.strCardID, out err);
                if (assres != null)
                {
                    string strAssState = assres.strAssState;
                    if (strAssState != "0")
                    {
                        MessageBox.Show("该会员已经失效,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    if (chs.dCurCharge == -1)
                    {
                        chs.dCurCharge = assres.dCharge;
                    }
                    if (int.Parse(SysInitial.Card) == 8)
                    {
                        if (chs.dCurCharge <= 2 && assres.strAssType == "AT001")
                        {
                            double dRate = 0;
                            if (!cs.AssTypeTrans(assres.strCardID, "AT002", out dRate, out err))
                            {
                                clog.WriteLine("变更卡类型失败:" + assres.strCardID + "。\n" + err.ToString());
                            }
                            else
                            {
                                assres.strAssType = "AT002";
                                assres.dRate      = dRate;
                            }
                        }
                        if (assres.strAssType == "AT001")
                        {
                            MessageBox.Show("老卡会员不允许充值,请先将卡内余额消费完!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                            return;
                        }
                    }
                    if (assres.dtCreateDate.CompareTo(SysInitial.dtQLTime) < 0 && !assres.setZeroFlag)
                    {
                        chs.iCurIg            = 0;
                        this.txtZeroFlag.Text = "1";
                    }
                    if (chs.iCurIg == -1)
                    {
                        chs.iCurIg = assres.iIgValue;
                    }
                    txtAssID.Text        = assres.strAssID;
                    txtCardID.Text       = assres.strCardID;
                    txtAssName.Text      = assres.strAssName;
                    this.txtAssType.Text = assres.strAssType;
                    txtLinkPhone.Text    = assres.strLinkPhone;
                    txtCharge.Text       = chs.dCurCharge.ToString();
                    this.txtIg.Text      = chs.iCurIg.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.º 11
0
        private void sbtnRead_Click(object sender, System.EventArgs e)
        {
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

            if (pr.Status != IPStatus.Success)
            {
                MessageBox.Show("童鞋,刷卡失败!vpn掉线了或者网速太慢!,请检查vpn连接!");
                return;
            }

            string strresult = "";

            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;
                }
                if (strresult != "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (strresult != null)
                {
                    clog.WriteLine(strresult);
                }
                return;
            }
            if (chs.strCardID == "")
            {
                MessageBox.Show("会员卡号不正确,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else if (chs.strCardID.Substring(0, 1) == "F")
            {
                MessageBox.Show("此卡为员工卡,不可进行积分兑换!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                err = null;
                CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
                assres = cs.GetAssociatorName(chs.strCardID, out err);
                if (assres != null)
                {
                    string strAssState = assres.strAssState;
                    if (strAssState != "0")
                    {
                        MessageBox.Show("该会员已经失效,卡号:" + chs.strCardID + ",请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    if (assres.dtCreateDate.CompareTo(SysInitial.dtQLTime) < 0 && !assres.setZeroFlag)
                    {
                        chs.iCurIg       = 0;
                        chs.needZeroFlag = true;
                    }
                    if (chs.iCurIg <= 0)
                    {
                        MessageBox.Show("当前积分不足,不能兑换!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    txtCardID.Text       = assres.strCardID;
                    txtAssName.Text      = assres.strAssName;
                    txtLinkPhone.Text    = assres.strLinkPhone;
                    txtCharge.Text       = chs.dCurCharge.ToString();
                    txtAssType.Text      = GetColCh(assres.strAssType, "AT");
                    txtAssID.Text        = assres.strAssID;
                    txtIgCur.Text        = chs.iCurIg.ToString();
                    txtGoodsID.ReadOnly  = false;
                    cmbGoodsName.Enabled = true;
                    txtCount.ReadOnly    = false;
                    sbtnRead.Enabled     = false;
                    cmbGoodsName.Focus();
                }
                else
                {
                    MessageBox.Show("无会员资料,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    if (err != null)
                    {
                        clog.WriteLine(err);
                    }
                    return;
                }
            }
        }
Ejemplo n.º 12
0
        private void sbtnRead_Click(object sender, System.EventArgs e)
        {
            this.sbtnToSilver.Enabled = false;
            this.sbtnToGold.Enabled   = false;
            this.lblContent.Text      = "";
            string strresult = "";

            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;
                }
                if (strresult != "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (strresult != null)
                {
                    clog.WriteLine(strresult);
                }
                return;
            }
            string aaccc = chs.strCardID;

            if (chs.strCardID == "")
            {
                MessageBox.Show("会员卡号不正确,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else if (chs.strCardID.Substring(0, 1) == "F")
            {
                MessageBox.Show("此卡为员工卡,不可进行充值!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                err = null;
                CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
                assres = cs.GetAssociatorName(chs.strCardID, out err);
                if (assres != null)
                {
                    string strAssState = assres.strAssState;
                    if (strAssState != "0")
                    {
                        MessageBox.Show("该会员已经失效,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    if (assres.dtCreateDate.CompareTo(SysInitial.dtQLTime) < 0 && !assres.setZeroFlag)
                    {
                        chs.iCurIg            = 0;
                        this.txtZeroFlag.Text = "1";
                    }
                    if (chs.iCurIg == -1)
                    {
                        chs.iCurIg = assres.iIgValue;
                    }
                    txtAssID.Text            = assres.strAssID;
                    txtCardID.Text           = assres.strCardID;
                    txtAssName.Text          = assres.strAssName;
                    txtLinkPhone.Text        = assres.strLinkPhone;
                    this.txtIg.Text          = chs.iCurIg.ToString();
                    this.txtAssTypeCode.Text = assres.strAssType;
                    this.txtAssType.Text     = this.GetColCh(assres.strAssType, "AT");
                    if (assres.strAssType == "AT001")
                    {
                        if (chs.iCurIg < 1000)
                        {
                            this.lblContent.Text = "该会员升级积分不足";
                        }
                        else
                        {
                            if (chs.iCurIg >= 1000)
                            {
                                this.lblContent.Text      = "该会员可由普通会员升级至银卡会员";
                                this.sbtnToSilver.Enabled = true;
                            }
                            if (chs.iCurIg >= 2000)
                            {
                                this.lblContent.Text    = "该会员可由普通会员升级至银卡会员或金卡会员";
                                this.sbtnToGold.Enabled = true;
                            }
                        }
                    }
                    if (assres.strAssType == "AT003")
                    {
                        if (chs.iCurIg < 1500)
                        {
                            this.lblContent.Text = "该会员升级积分不足";
                        }
                        else
                        {
                            this.lblContent.Text    = "该会员可由银卡会员升级至金卡会员";
                            this.sbtnToGold.Enabled = true;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("无此会员,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    if (err != null)
                    {
                        clog.WriteLine(err);
                    }
                }
            }
        }
Ejemplo n.º 13
0
        private void sbtnAgain_Click(object sender, System.EventArgs e)
        {
            if (dataGrid1.CurrentRowIndex < 0)
            {
                MessageBox.Show("没有选中已挂失的会员!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                return;
            }
            err = null;
            string strCardID = dataGrid1[dataGrid1.CurrentRowIndex, 1].ToString();

            CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

            if (pr.Status != IPStatus.Success)
            {
                MessageBox.Show("童鞋,不能补卡!vpn掉线了或者网速太慢!,请检查vpn连接!");
                return;
            }

            assres = cs.GetAssociatorLost(strCardID, out err);
            if (assres == null || err != null)
            {
                MessageBox.Show("获取会员资料错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null)
                {
                    clog.WriteLine(err);
                }
                return;
            }

            frmInputBox frmInput = new frmInputBox();

            frmInput.Text        = "补卡输入新卡号";
            frmInput.label1.Text = "请输入新会员卡的卡号:";
            frmInput.label2.Text = "Again";
            frmInput.ShowDialog();
            if (SysInitial.strTmp == "CanCel")
            {
                return;
            }
            while (SysInitial.strTmp == "")
            {
                MessageBox.Show("输入的会员卡号不正确,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                frmInput = new frmInputBox();
                frmInput.ShowDialog();
                if (SysInitial.strTmp == "CanCel")
                {
                    return;
                }
            }

            string strNewCardID = SysInitial.strTmp;

            SysInitial.strTmp = "";

            if (assres.dtCreateDate.CompareTo(SysInitial.dtQLTime) < 0 && !assres.setZeroFlag)
            {
                assres.iIgValue     = 0;
                assres.needZeroFlag = true;
            }

            err = null;
            string strresult = cs.CardAgain(strNewCardID, assres, out err);

            if (err != null || (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK)))
            {
                if (strresult == "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("补发卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null || strresult != null)
                {
                    clog.WriteLine(err + "\n" + strresult);
                }
            }
            else
            {
                MessageBox.Show("补发卡成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.DgBind();
            }
        }
Ejemplo n.º 14
0
        private void btnRead_Click(object sender, System.EventArgs e)
        {
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

            if (pr.Status != IPStatus.Success)
            {
                MessageBox.Show("童鞋,挂失失败!vpn掉线了或者网速太慢!,请检查vpn连接!");
                return;
            }
            string strresult = "";

            CMSMStruct.CardHardStruct 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;
                }
                if (strresult.Substring(0, 2) == "RF")
                {
                    MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("刷卡失败,请重试!\n" + strresult, "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
                if (strresult != null)
                {
                    clog.WriteLine(strresult);
                }
                return;
            }
            if (chs.strCardID == "")
            {
                MessageBox.Show("会员卡号不正确,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else if (chs.strCardID.Substring(0, 1) == "F")
            {
                MessageBox.Show("此卡为员工卡,不可进行充值撤消!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                err = null;
                CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
                assres = cs.GetAssociatorName(chs.strCardID, out err);
                if (assres != null)
                {
                    DataRow[] drn = SysInitial.dsSys.Tables["AS"].Select("vcCommCode='" + assres.strAssState + "'");
                    if (drn == null || drn.Length == 0)
                    {
                        MessageBox.Show("会员状态参数错误,请检查参数或重新启动系统!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        string strAssState = drn[0]["vcCommName"].ToString();
                        if (assres.strAssState != "0")
                        {
                            MessageBox.Show("该会员已经失效,卡号:" + chs.strCardID + ",现处于“" + strAssState + "”状态,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                            return;
                        }
                    }

                    err = null;
                    DataTable dtFillFee = cs.GetAssFillLast(assres.strCardID, out err);
                    if (dtFillFee == null || err != null)
                    {
                        MessageBox.Show(err.Message, "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        txtAssID.Text     = assres.strAssID;
                        txtCurCharge.Text = dtFillFee.Rows[0]["nFeeCur"].ToString();
                        txtCardID.Text    = assres.strCardID;
                        txtAssName.Text   = assres.strAssName;

                        this.txtFillSerial.Text = dtFillFee.Rows[0]["iSerial"].ToString();
                        this.txtFillFee.Text    = dtFillFee.Rows[0]["nFillFee"].ToString();
                        this.txtFillDate.Text   = dtFillFee.Rows[0]["dtFillDate"].ToString();
                        this.txtPromFee.Text    = dtFillFee.Rows[0]["nFillProm"].ToString();
                        strOldDate = dtFillFee.Rows[0]["dtFillDate"].ToString();

                        btnRead.Enabled        = false;
                        this.btnRemove.Enabled = true;
                    }
                }
                else
                {
                    MessageBox.Show("无会员资料,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    if (err != null)
                    {
                        clog.WriteLine(err);
                    }
                    return;
                }
            }
        }