/// <summary> /// 进行读卡操作 /// </summary> private void ReadCard() { //先读取卡内信息 CardInfoBLL _cardBll = new CardInfoBLL(); int status = -1; //保存读取后返回的一个状态 Bouwa.ITSP2V31.Model.CardInfo _cardInfo = _cardBll.GetCardInfoByCard(Bouwa.Helper.CurrentUser.Current.PassWordKey, out status); try { string password = CurrentUser.Current.PassWordKey; bool flag = false; string[] mary1 = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(password, Convert.ToInt32(1))); if (mary1[4] == "11" || mary1[4] == "12") { flag = true; password = SystemConstant.StringEmpty; mary1 = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(password, Convert.ToInt32(1))); } if (mary1[4] != "0") { throw new Exception(RFIDClass.ConvertMeassByStatus(Convert.ToInt32(mary1[4]))); } if (string.IsNullOrEmpty(_cardInfo.card_id)) { MessageBoxForm.Show("未读取到卡信息,请将卡放到读卡器上!", MessageBoxButtons.OK); return; } //执行查询 BindingSource bs = new BindingSource(); Hashtable objHashtable = new Hashtable(); objHashtable.Add("no", _cardInfo.no); objHashtable.Add("cost_type", (int)_cardInfo.cost_type); //扣费类型 objHashtable.Add("card_id", _cardInfo.card_id); //卡内编号 //objHashtable.Add("saas_id", CurrentUser.Current.SAASID); IList <Bouwa.ITSP2V31.Model.CardInfo> CardInfo = _objCardInfoBLL.SearchByCondition(objHashtable, null, 1, 1, "[status] DESC", ref _objSystemMessageInfo); //说明注册过了 if (CardInfo != null && CardInfo.Count > 0) { Bouwa.ITSP2V31.Win.CardInfo.View frmCardInfoEdit = new Bouwa.ITSP2V31.Win.CardInfo.View(); frmCardInfoEdit.Parameter.Add("ActionType", ActionType.View.ToString("D")); frmCardInfoEdit.Parameter.Add("Id", CardInfo[0].id.ToString()); frmCardInfoEdit.StartPosition = FormStartPosition.CenterScreen; frmCardInfoEdit.ShowDialog(this); }//说明未注册 else { MessageBoxForm.Show("停车卡未在后台注册,请联系管理员!", MessageBoxButtons.OK); } } catch (Exception ex) { Bouwa.Helper.Class.Log.WriterLine(Bouwa.Helper.Class.ELevel.error, "读卡出现异常", ex.Message); MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(status), MessageBoxButtons.OK); } }
/// <summary> /// 进行读卡操作 /// </summary> private void ReadCard() { //先读取卡内信息 CardInfoBLL _cardBll = new CardInfoBLL(); int status = -1; //保存读取后返回的一个状态 Bouwa.ITSP2V31.Model.CardInfo _cardInfo = _cardBll.GetCardInfoByCard(Bouwa.Helper.CurrentUser.Current.PassWordKey, out status); try { //string[] mary1 = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(CurrentUser.Current.PassWordKey, Convert.ToInt32(1))); //if (mary1[4] != "0") //{ // //MessageBoxForm.Show(RFIDClass.ConvertMeassByStatus(Convert.ToInt32(mary1[4]))); // throw new Exception(RFIDClass.ConvertMeassByStatus(Convert.ToInt32(mary1[4]))); //} ////string[] mary6 = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(CurrentUser.Current.PassWordKey, Convert.ToInt32(6))); ////判断当前读的卡是否能初始化的条件; 1: 卡状态为空卡255 ;2:卡状态为已充值,但最后操作时间为空 //string cardStatus = mary1[2].ToString(); //if (cardStatus.Length >= 16) //{ // cardStatus = HelperClass.getCardStatus(cardStatus.Substring(13, 1)); //} //else //{ // cardStatus = Bouwa.ITSP2V31.Model.CardTypeInfo.CardTypeInfoDefaultCardStatus.空白卡.ToString("D"); //} //if (cardStatus.Equals(CardTypeInfo.CardTypeInfoDefaultCardStatus.空白卡.ToString("D")) // || (cardStatus.Equals(CardTypeInfo.CardTypeInfoDefaultCardStatus.已充值.ToString("D")) && string.IsNullOrEmpty(HelperClass.DecryptByString(mary1[3]))) // || _cardInfo ==null // ) //{ // Bouwa.ITSP2V31.WIN.CardType.CardTypeList frmCardType = new Bouwa.ITSP2V31.WIN.CardType.CardTypeList(); // MessageBoxForm.Show("停车卡还未初始化,需先初始化停车卡!", MessageBoxButtons.OK); // frmCardType.StartPosition = FormStartPosition.CenterScreen; // frmCardType.ShowDialog(this); // return; //} //再去读取一次 if (status == 11 || status == 12) { _cardInfo = _cardBll.GetCardInfoByCard(string.Empty, out status); } if (status != 0) { MessageBoxForm.Show(RFIDClass.ConvertMeassByStatus(status), MessageBoxButtons.OK); return; } else if (_cardInfo == null) { MessageBoxForm.Show("此卡为空卡,请先进行初始化!", MessageBoxButtons.OK); return; } //执行查询 BindingSource bs = new BindingSource(); Hashtable objHashtable = new Hashtable(); objHashtable.Add("no", _cardInfo.no); objHashtable.Add("cost_type", (int)_cardInfo.cost_type); //扣费类型 objHashtable.Add("card_id", _cardInfo.card_id); //卡内编号 //objHashtable.Add("saas_id", CurrentUser.Current.SAASID); IList <Bouwa.ITSP2V31.Model.CardInfo> CardInfo = _objCardInfoBLL.SearchByCondition(objHashtable, null, 1, 1, "[status] DESC", ref _objSystemMessageInfo); //说明注册过了 if (CardInfo != null && CardInfo.Count > 0) { Bouwa.ITSP2V31.Win.CardInfo.View frmCardInfoEdit = new Bouwa.ITSP2V31.Win.CardInfo.View(); frmCardInfoEdit.Parameter.Add("ActionType", ActionType.View.ToString("D")); frmCardInfoEdit.Parameter.Add("Id", CardInfo[0].id.ToString()); frmCardInfoEdit.StartPosition = FormStartPosition.CenterScreen; frmCardInfoEdit.ShowDialog(this); }//说明未注册 else { //Bouwa.ITSP2V31.WIN.CardType.CardTypeList frmCardType = new Bouwa.ITSP2V31.WIN.CardType.CardTypeList(); //MessageBoxForm.Show("停车卡还未初始化,需先初始化停车卡!", MessageBoxButtons.OK); MessageBoxForm.Show("后台未找到停车卡信息,请联系管理员!", MessageBoxButtons.OK); //frmCardType.StartPosition = FormStartPosition.CenterScreen; //frmCardType.ShowDialog(this); return; } } catch (Exception ex) { Bouwa.Helper.Class.Log.WriterLine(Bouwa.Helper.Class.ELevel.error, "读卡出现异常", ex.Message); MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(status), MessageBoxButtons.OK); } }
//==================================================== //[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")] //private static extern IntPtr CreateRoundRectRgn //( // int nLeftRect, // x-coordinate of upper-left corner // int nTopRect, // y-coordinate of upper-left corner // int nRightRect, // x-coordinate of lower-right corner // int nBottomRect, // y-coordinate of lower-right corner // int nWidthEllipse, // height of ellipse // int nHeightEllipse // width of ellipse //); //public static System.Drawing.Region GetRoundedRegion(int controlWidth, int controlHeight) //{ // return System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, controlWidth - 2, controlHeight - 2, 10, 10)); //} public Card(int X, int cardId, int index, ListSpace listSpace) { InitializeComponent(); _cardId = cardId; oX = X; oY = 3 + (index + 3) * this.Height; _listSpace = listSpace; //this.Region = GetRoundedRegion(this.Width, this.Height); cardInfoBLL = new CardInfoBLL(); cardInfoDTO = cardInfoBLL.CardInfo(_cardId); cardDTO = cardInfoDTO.Card; listNameUser = cardInfoDTO.ListNameUser; CardName.Text = cardDTO.Title; dateCard.Text = cardDTO.DueDate.ToShortDateString(); if (cardInfoDTO.CountCmt != 0) { panel2.Visible = true; label3.Text = cardInfoDTO.CountCmt.ToString(); } else { panel2.Visible = false; } if (cardDTO.Description == null || cardDTO.Description == "") { this.desPicture.Visible = false; } else { this.desPicture.Visible = true; } foreach (string name in listNameUser) { MemIcon member = new MemIcon(name, 25, 25); this.flowLayoutPanel3.Controls.Add(member); } if (cardDTO.Description.Equals("")) { this.desPicture.Visible = false; } else { this.desPicture.Visible = true; } switch (cardDTO.Label) { case 1: this.CardLabel.BackColor = Color.Red; break; case 2: this.CardLabel.BackColor = Color.Yellow; break; case 3: this.CardLabel.BackColor = Color.Green; break; case 4: this.CardLabel.BackColor = Color.Orange; break; case 5: this.CardLabel.BackColor = Color.Blue; break; case 6: this.CardLabel.BackColor = Color.Fuchsia; break; default: this.CardLabel.BackColor = Color.Transparent; break; } if (cardInfoDTO.CountChecklist != 0) { checkBox1.Visible = true; checkBox1.Text = cardInfoDTO.CountCheckedlist + "/" + cardInfoDTO.CountChecklist; } else { checkBox1.Visible = false; } }
/// <summary> /// 构造函数 /// </summary> public PersonalCenterController() { ptInfoBLL = new PtInfoBLL(); cardInfoBLL = new CardInfoBLL(); feeinfoBLL = new FeeinfoBLL(); }
public CardEdit(int X, int Y, int cardId, ListSpace listSpace) { InitializeComponent(); _cardId = cardId; _listSpace = listSpace; cardDTO = cardBLL.GetCard(_cardId); cardInfoBLL = new CardInfoBLL(); commentBLL = new CommentBLL(); cardInfoDTO = cardInfoBLL.CardInfo(_cardId); listNameUser = cardInfoDTO.ListNameUser; this.Location = new Point(X, Y); this.StartPosition = FormStartPosition.CenterScreen; switch (cardDTO.Label) { case 1: this.CardLabel.BackColor = Color.Red; break; case 2: this.CardLabel.BackColor = Color.Yellow; break; case 3: this.CardLabel.BackColor = Color.Green; break; case 4: this.CardLabel.BackColor = Color.Orange; break; case 5: this.CardLabel.BackColor = Color.Blue; break; case 6: this.CardLabel.BackColor = Color.Fuchsia; break; default: this.CardLabel.BackColor = Color.Transparent; break; } this.cardName.Text = cardDTO.Title; this.dateTime.Text = cardDTO.DueDate.ToShortDateString(); if (cardDTO.Description == null || cardDTO.Description == "") { this.desPic.Visible = false; } else { this.desPic.Visible = true; } if (commentBLL.GetAllComments(_cardId).Count() != 0) { panel2.Visible = true; cmtNum.Text = commentBLL.GetAllComments(_cardId).Count().ToString(); } else { panel2.Visible = false; } if (cardInfoDTO.CountChecklist != 0) { this.checkList.Visible = true; this.checkList.Text = cardInfoDTO.CountCheckedlist + "/" + cardInfoDTO.CountChecklist; } else { this.checkList.Visible = false; } foreach (string name in listNameUser) { MemIcon member = new MemIcon(name, 25, 25); this.flowLayoutPanel2.Controls.Add(member); } }