private void btnSend_Click(object sender, EventArgs e) { strFactoryCode = commclass.strFactoryCode; strNewFactoryCode = commclass.strNewFactoryCode; strNewMarkedCode = commclass.strNewMarkedCode; strExistFactoryCode = commclass.strExistFactoryCode; strExistMarkedCode = commclass.strExistMarkedCode; if (strFactoryCode == "") { alarmSound.Alarm("请刷标识卡"); return; } //CoalTraffic.Model.TT_MarkedCard model = new CoalTraffic.Model.TT_MarkedCard(); TT_MarkedCard model = new TT_MarkedCard(); model.CoalKindCode = this.cbxCoalKind.SelectedValue.ToString(); //string sql = string.Format("select CollCode from CoalTraffic.dbo.Sys_Colliery where CollName='{0}'", this.cbxColl.Text.Trim()); //model.CollCode = DbHelperSQL.GetSingle(sql).ToString(); model.CollCode = this.cbxColl.SelectedValue.ToString(); model.DepartName = this.txtDepartName.Text.Trim(); model.Operator = this.txtOperator.Text.Trim(); model.MarkedCardState = "1"; model.MarkedCardNo = strExistFactoryCode.TrimEnd('|'); model.MarkedCardCode = strExistMarkedCode.TrimEnd('|'); model.SendCardDate = DateTime.Now; if (bll.Add(strNewFactoryCode.TrimEnd('|'), strNewMarkedCode.TrimEnd('|'), model)) { List<string> list = new List<string>(); list.Add(this.cbxColl.Text); list.Add(this.cbxCoalKind.Text); list.Add(this.txtAdded.Text.Trim()); list.Add(this.txtOperator.Text); list.Add(model.SendCardDate.ToString()); list.Add(this.txtDepartName.Text); //清空数据,使其可以刷另一张卡 strNewFactoryCode = ""; strNewMarkedCode = ""; strFactoryCode = ""; strExistFactoryCode = ""; strExistMarkedCode = ""; this.txtAdded.Text = "0"; this.txtBuyCount.Text = "10"; this.txtMarkedCode.Text = ""; alarmSound.Alarm("标 识 卡 发 放 成 功 即 将 打 印 购 买 凭 证!"); #region 打印相关 if (ckPrint.Checked == true) { new Report.MarkedCardPrint(list, "购买").ShowDialog(); } else { MessageBox.Show("本次发卡不打印!", "天大天科"); } #endregion } else alarmSound.Alarm("标识卡发放失败!"); clearcommclass(); }
private void btnSend_Click(object sender, EventArgs e) { strFactoryCode = commclass.SCardNo; strMarkedCode = commclass.SCardCode; if (strFactoryCode == "") { alarmSound.Alarm("请刷标识卡"); return; } TT_MarkedCard model = new TT_MarkedCard(); model.MarkedCardState = "0";//标识卡状态 model.MarkedCardNo = strFactoryCode.TrimEnd('|'); model.MarkedCardCode = strMarkedCode.TrimEnd('|');//String ..::.TrimEnd 方法 去掉指定字符串中的指定符号 model.SendCardDate = DateTime.Now;//刷卡时间 if (bll.Update(model))//验证到服务器数据 { alarmSound.Alarm("标识卡验证 成 功!"); //保存打印信息 List<string> list = new List<string>(); list.Add(this.txtAdded.Text.Trim()); list.Add(model.SendCardDate.ToString()); strFactoryCode = ""; strMarkedCode = ""; this.txtAdded.Text = "0"; this.txtMarkedCode.Text = ""; } else { alarmSound.Alarm("标识卡验证失败!"); //对目前类中的数据进行初始化 clearCommclass(); } }