Esempio n. 1
0
        private void mnu_SyncCardToStandby_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(Resource1.FrmSyncDataToStandby_Cover, Resource1.Form_Alert, MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2)
                == DialogResult.No)
            {
                return;
            }

            this.Cursor = Cursors.WaitCursor;
            List <CardInfo> downloadItems = this.cardView.GetSelectedCards();

            if (downloadItems.Count > 0)
            {
                int     count      = 0;
                CardBll standbybll = new CardBll(AppSettings.CurrentSetting.CurrentStandbyConnect);
                foreach (CardInfo item in downloadItems)
                {
                    if (standbybll.UpdateOrInsert(item).Result == ResultCode.Successful)
                    {
                        count++;
                    }
                }
                MessageBox.Show(string.Format(Resource1.FrmCards_SyncCardToStandby, downloadItems.Count.ToString(), count.ToString()));
            }
            this.Cursor = Cursors.Arrow;
        }
Esempio n. 2
0
 //强制删除卡片
 private bool DeletingCardAtAll(CardInfo info)
 {
     try
     {
         CommandResult ret = bll.DeleteCardAtAll(info);
         if (ret.Result == ResultCode.Successful)
         {
             if (DataBaseConnectionsManager.Current.StandbyConnected)
             {
                 CardBll standbybll = new CardBll(AppSettings.CurrentSetting.CurrentStandbyConnect);
                 standbybll.DeleteCardAtAll(info);
             }
             //foreach (ParkingAdapter pad in ParkingAdapterManager.Instance.ParkAdapters)
             //{
             //    pad.DeleteCard(info);
             //}
             return(true);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     return(false);
 }
Esempio n. 3
0
        /// <summary>
        /// 退款
        /// </summary>
        private void Refund(CardInfo cardinfo)
        {
            bool offlineHandleCard = AppSettings.CurrentSetting.EnableWriteCard &&
                                     cardinfo != null &&
                                     !cardinfo.OnlineHandleWhenOfflineMode;

            APMRefundRecord record = CreateAPMRefundRecord(cardinfo);

            CardBll _CardBll = new CardBll(AppSettings.CurrentSetting.ParkConnect);
            bool    success  = _CardBll.APMCardRefund(cardinfo, record).Result == ResultCode.Successful;

            if (offlineHandleCard && success)
            {
                success = CardOperationManager.Instance.WriteCardLoop(cardinfo) == CardOperationResultCode.Success;
                if (!success)
                {
                    //写入失败时,将数据库的卡片退款信息还原
                    _CardBll.UpdateCardPaymentInfo(_OriginalCard);
                    APMRefundRecordBll recordBll = new APMRefundRecordBll(AppSettings.CurrentSetting.ParkConnect);
                    recordBll.Delete(record);
                }
            }

            if (success)
            {
                MessageBox.Show(Resource1.FrmAPMRefund_Success);
                ClearInput();
            }
            else
            {
                MessageBox.Show(Resource1.FrmAPMRefund_Fail);
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BindCard();
            int id;

            if (!IsPostBack)
            {
                try
                {
                    if (Request.QueryString["cardid"] != null)
                    {
                        id = Convert.ToInt32(Request.QueryString["cardid"].ToString());
                        if (CardBll.deletecard(id) == 1)
                        {
                            BindCard();
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除失败!');</script>");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("错误原因:" + ex.Message);
                }
            }
        }
Esempio n. 5
0
        private CommandResult SaveCardPayment(PaymentMode paymentMode)
        {
            CommandResult result = null;

            _ChargeRecord.PaymentMode    = paymentMode;
            _ChargeRecord.OperatorID     = OperatorInfo.CurrentOperator.OperatorName;
            _ChargeRecord.StationID      = WorkStationInfo.CurrentStation.StationName;
            _ChargeRecord.Paid           = this.txtPaid.DecimalValue;
            _ChargeRecord.Discount       = _ChargeRecord.Accounts - this.txtPaid.DecimalValue;
            _ChargeRecord.IsCenterCharge = true;
            _ChargeRecord.Memo           = this.txtMemo.Text;

            CardBll cbll = new CardBll(AppSettings.CurrentSetting.CurrentMasterConnect);

            bool both = WorkStationInfo.CurrentStation.NeedBothDatabaseUpdate;
            bool offlineHandleCard = AppSettings.CurrentSetting.EnableWriteCard &&
                                     _cardInfo != null &&
                                     !_cardInfo.OnlineHandleWhenOfflineMode;

            result = cbll.PayParkFee(_cardInfo, _ChargeRecord, AppSettings.CurrentSetting.CurrentStandbyConnect, both, offlineHandleCard);

            if (result.Result != ResultCode.Successful && offlineHandleCard)
            {
                //与主数据库通信故障时,脱机模式时按脱机模式处理的卡片,收费信息写入本地数据库,待通信正在时,上传到主数据库
                LDB_CardPaymentRecordBll ldb_cbll = new LDB_CardPaymentRecordBll(LDB_AppSettings.Current.LDBConnect);
                result = ldb_cbll.PayParkFee(_cardInfo, _ChargeRecord);
            }

            //写卡模式需要将收费信息写入卡片扇区
            if (result.Result == ResultCode.Successful && offlineHandleCard)
            {
                CardOperationManager.Instance.WriteCardLoop(_cardInfo);
            }
            return(result);
        }
Esempio n. 6
0
        private void ExecuteWaitingCommand_Thread()
        {
            CardBll           cb = new CardBll(AppSettings.CurrentSetting.ParkConnect);
            WaitingCommandBLL wb = new WaitingCommandBLL(AppSettings.CurrentSetting.ParkConnect);

            while (true)
            {
                List <WaitingCommandInfo> wcs = wb.GetCommands(this.ParkID).QueryObjects;
                foreach (var wc in wcs)
                {
                    CardInfo card = cb.GetCardByID(wc.CardID).QueryObject;
                    if (card != null)
                    {
                        if (SaveCard(card, ActionType.Upate))
                        {
                            wb.Delete(wc);
                        }
                    }
                    else
                    {
                        wb.Delete(wc);
                    }
                }
                Thread.Sleep(60000);
            }
        }
Esempio n. 7
0
        private CommandResult SaveCardPayment(CardPaymentInfo cardPayment, PaymentMode paymentMode)
        {
            CommandResult result = null;

            cardPayment.Paid           = txtPaid.DecimalValue;
            cardPayment.Discount       = cardPayment.Accounts - cardPayment.Paid;
            cardPayment.Memo           = txtMemo.Text;
            cardPayment.PaymentMode    = paymentMode;
            cardPayment.OperatorID     = OperatorInfo.CurrentOperator.OperatorName;
            cardPayment.StationID      = WorkStationInfo.CurrentStation.StationName;
            cardPayment.IsCenterCharge = false;
            CardBll cbll = new CardBll(AppSettings.CurrentSetting.ParkConnect);

            result = cbll.PayParkFee(_cardInfo, cardPayment);

            //写卡模式并且不是按在线模式处理时需要将收费信息写入卡片扇区
            if (AppSettings.CurrentSetting.EnableWriteCard &&
                result.Result == ResultCode.Successful &&
                !_processingEvent.OnlineHandleWhenOfflineMode)
            {
                _cardInfo.IsInPark = false;//标记已出场
                CardOperationManager.Instance.WriteCardLoop(_cardInfo);
            }

            return(result);
        }
        protected override void OnItemSearching(EventArgs e)
        {
            this.customDataGridView1.Rows.Clear();
            RecordSearchCondition con = new RecordSearchCondition();

            con.RecordDateTimeRange       = new DateTimeRange();
            con.RecordDateTimeRange.Begin = this.ucDateTimeInterval1.StartDateTime;
            con.RecordDateTimeRange.End   = this.ucDateTimeInterval1.EndDateTime;
            con.CardID    = this.txtCardID.Text.Trim();
            con.Operator  = this.operatorCombobox1.SelectecOperator;
            con.StationID = this.workStationCombobox1.Text;
            CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect);
            List <CardDeferRecord> items = bll.GetCardDeferRecords(con).QueryObjects;

            if (items != null && items.Count > 0)
            {
                CarFlowStatisticsType group;
                if (this.rdPerHour.Checked)
                {
                    group = CarFlowStatisticsType.perHour;
                }
                else if (this.rdPerDay.Checked)
                {
                    group = CarFlowStatisticsType.perDay;
                }
                else
                {
                    group = CarFlowStatisticsType.perMonth;
                }
                GroupBy(items, group);
            }
        }
Esempio n. 9
0
        private void txtCardID_TextChanged(object sender, EventArgs e)
        {
            string cardID = this.txtCardID.Text.Trim();

            #region 如果扫描枪使用模拟键盘输入
            if (AppSettings.CurrentSetting.TicketReaderCOMPort == 0)
            {
                if (cardID.Length == 8)
                {
                    string ck = Ralid.GeneralLibrary.ITFCheckCreater.Create(cardID.Substring(0, cardID.Length - 1));
                    if (!string.IsNullOrEmpty(ck) && ck == cardID.Substring(cardID.Length - 1, 1))
                    {
                        cardID = cardID.Substring(0, cardID.Length - 1);
                        this.txtCardID.TextChanged -= txtCardID_TextChanged;
                        this.txtCardID.Text         = cardID;
                        this.txtCardID.TextChanged += txtCardID_TextChanged;
                    }
                }
            }
            #endregion

            if (!string.IsNullOrEmpty(cardID))
            {
                CardBll  bll  = new CardBll(AppSettings.CurrentSetting.ParkConnect);
                CardInfo card = bll.GetCardByID(cardID).QueryObject;
                ShowCardInfo(card);
            }
        }
Esempio n. 10
0
 private void txtCardID_TextChanged(object sender, EventArgs e)
 {
     //卡片名单时才检查
     if (this.ucCard1.rdbCardList.Checked)
     {
         string cardID = this.ucCard1.txtCardID.Text.Trim(' ', '\n');
         if (!string.IsNullOrEmpty(cardID))
         {
             CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect);
             QueryResult <CardInfo> result = bll.GetCardByID(cardID);
             if (result.Result == ResultCode.Successful)
             {
                 CardInfo info = result.QueryObject;
                 if (!info.ReleasAble)
                 {
                     MessageBox.Show(string.Format(Resources.Resource1.UcCard_CannotRelease, cardID));
                     this.ucCard1.txtCardID.Focus();
                     btnOk.Enabled = false;
                 }
                 else
                 {
                     ReleasingCard     = info;
                     this.ucCard1.Card = ReleasingCard;
                     this._isAdding    = false;
                     btnOk.Enabled     = true;
                 }
             }
             else
             {
                 this._isAdding = true;
                 btnOk.Enabled  = true;
             }
         }
     }
 }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id;

            if (!IsPostBack)
            {
                if (Request.QueryString["cardid"] != null)
                {
                    id = Convert.ToInt32(Request.QueryString["cardid"].ToString());
                    SqlDataReader dt = CardBll.idcard(id);
                    dt.Read();
                    if (dt != null)
                    {
                        name.Text       = dt[1].ToString().Trim();
                        cost.Text       = dt[2].ToString().Trim();
                        rd.Text         = dt[3].ToString().Trim();
                        hp.Text         = dt[4].ToString().Trim();
                        ap.Text         = dt[5].ToString().Trim();
                        effect.Text     = dt[6].ToString().Trim();
                        ch.Text         = dt[7].ToString().Trim();
                        race.Text       = dt[8].ToString().Trim();
                        occupation.Text = dt[9].ToString().Trim();
                        off.Text        = dt[10].ToString().Trim();
                        img.ImageUrl    = dt[11].ToString().Trim();
                    }
                }
            }
        }
Esempio n. 12
0
        private CommandResult SaveCardPayment(PaymentMode paymentMode)
        {
            CommandResult result = null;

            _ChargeRecord.PaymentMode    = paymentMode;
            _ChargeRecord.OperatorID     = OperatorInfo.CurrentOperator.OperatorName;
            _ChargeRecord.StationID      = WorkStationInfo.CurrentStation.StationName;
            _ChargeRecord.Paid           = this.txtPaid.DecimalValue;
            _ChargeRecord.Discount       = _ChargeRecord.Accounts - this.txtPaid.DecimalValue;
            _ChargeRecord.IsCenterCharge = true;
            _ChargeRecord.Memo           = this.txtMemo.Text;
            CardBll cbll = new CardBll(AppSettings.CurrentSetting.ParkConnect);

            result = cbll.PayParkFee(_cardInfo, _ChargeRecord);

            //写卡模式需要将收费信息写入卡片扇区
            if (AppSettings.CurrentSetting.EnableWriteCard &&
                _cardInfo != null &&
                !_cardInfo.OnlineHandleWhenOfflineMode &&
                result.Result == ResultCode.Successful)
            {
                CardOperationManager.Instance.WriteCardLoop(_cardInfo);
            }
            return(result);
        }
Esempio n. 13
0
        protected void UpdateCard_Click(object sender, EventArgs e)
        {
            Card card = new Card();

            card.Card_ID1             = Convert.ToInt32(Request.QueryString["cardid"].ToString());
            card.Card_Name1           = txtName.Text.Trim();
            card.Card_Cost1           = int.Parse(DropDownList_cost.SelectedItem.Text);
            card.Card_Rd1             = DropDownList_rd.SelectedItem.Text.ToString();
            card.Card_Ap1             = int.Parse(txtAp.Text.Trim());
            card.Card_Hp1             = int.Parse(txtHp.Text.Trim());
            card.Card_Characteristic1 = DropDownList_ch.SelectedItem.Text;
            card.Card_Race1           = DropDownList_Race.SelectedItem.Text;
            card.Card_Effect1         = txtEffect.Text.Trim();
            card.Card_Occupation1     = DropDownList3.SelectedItem.Text;
            card.Card_Off1            = DropDownList_off.SelectedItem.Text;
            card.Card_Img1            = @"~/Img_Card/" + FileUpload_img.PostedFile.FileName;
            try
            {
                if (CardBll.updatecard(card) == 1)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('修改成功!');</script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(object), "alert", "<script>alert('修改失败!');</script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write("错误原因:" + ex.Message);
            }
        }
Esempio n. 14
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (RecycleCard != null)
            {
                if (CheckInput())
                {
                    decimal money;
                    money = this.txtTurnbackMoney.DecimalValue;
                    CardBll       bll    = new CardBll(AppSettings.CurrentSetting.ParkConnect);
                    CommandResult result = bll.CardRecycle(this.RecycleCard, money, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard);
                    if (result.Result == ResultCode.Successful)
                    {
                        //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消
                        if (this.chkWriteCard.Checked)
                        {
                            CardOperationManager.Instance.WriteCardLoop(RecycleCard);
                        }

                        if (this.ItemUpdated != null)
                        {
                            ItemUpdated(this, new ItemUpdatedEventArgs(RecycleCard));
                        }
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(result.Message);
                    }
                }
            }
        }
Esempio n. 15
0
        private void ShowSpeedingDetail(CardInvalidEventReport info)
        {
            ClearDetail();

            CardBll  cbll = new CardBll(AppSettings.CurrentSetting.ParkConnect);
            CardInfo card = cbll.GetCardByID(info.CardID).QueryObject;

            if (card == null)
            {
                return;              //没找到卡片,返回
            }
            this.lblCardID.Text     = card.CardID;
            this.lblCarPlate.Text   = card.CarPlate;
            this.lblOwner.Text      = card.OwnerName;
            this.lblDepartment.Text = card.Department;

            if (!string.IsNullOrEmpty(card.CarPlate))
            {
                SpeedingRecordBll     sbll    = new SpeedingRecordBll(AppSettings.CurrentSetting.ParkConnect);
                List <SpeedingRecord> records = sbll.GetRecordsByCarPlate(card.CarPlate).QueryObjects;
                ShowSpeedingRecords(records);
            }

            ucVideoes.ShowVideoes(ParkBuffer.Current.GetEntrance(info.EntranceID).VideoSources);
        }
Esempio n. 16
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                CardBll       bll = new CardBll(AppSettings.CurrentSetting.ParkConnect);
                CommandResult result;
                if (this.DisableEnableCard.Status == CardStatus.Disabled)
                {
                    result = bll.CardEnable(this.DisableEnableCard, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard);
                }
                else
                {
                    result = bll.CardDisable(this.DisableEnableCard, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard);
                }
                if (result.Result == ResultCode.Successful)
                {
                    //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消
                    if (this.chkWriteCard.Checked)
                    {
                        CardOperationManager.Instance.WriteCardLoop(DisableEnableCard);
                    }

                    if (ItemUpdated != null)
                    {
                        ItemUpdated(this, new ItemUpdatedEventArgs(DisableEnableCard));
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show(result.Message);
                }
            }
        }
Esempio n. 17
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            switch (_curStep)
            {
            case step_welcome:
                _curStep++;
                break;

            case step_input:
                if (CheckInput())
                {
                    _curStep++;
                }
                break;

            case step_readCard:
                _curStep++;
                break;

            case step_excute:
                List <CardInfo> cards = cardView.CardSource;
                if (cards != null && cards.Count > 0)
                {
                    CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect);
                    this.progressBar1.Maximum = cards.Count;
                    this.progressBar1.Value   = 0;
                    //bool download = true;
                    foreach (CardInfo card in cards)
                    {
                        CommandResult ret = null;
                        if (card.Status == CardStatus.Enabled)
                        {
                            ret = bll.CardRelease(card, 0, PaymentMode.Cash, string.Empty);
                        }
                        else
                        {
                            ret = bll.AddCard(card);
                        }
                        if (ret.Result == ResultCode.Successful)
                        {
                            this.CardAdded(this, new ItemAddedEventArgs(card));
                        }
                        progressBar1.Value++;
                        lblStatus.Text = string.Format(Resources.Resource1.FrmAddCards_Processing,
                                                       progressBar1.Value, progressBar1.Maximum);
                        lblStatus.Refresh();
                    }
                }
                lblAlarm.Text = string.Format(Resources.Resource1.FrmAddCards_CardCount, 0);
                _curStep++;
                break;

            case step_recycle:
                _curStep = step_welcome;
                InitCardGrid();
                this.progressBar1.Value = 0;
                break;
            }
            ShowNextStep(_curStep);
        }
Esempio n. 18
0
        ///// <summary>
        ///// 脱机模式时按在线模式处理的检验
        ///// </summary>
        ///// <param name="card"></param>
        ///// <param name="msg"></param>
        ///// <returns></returns>
        //private bool OnlineHandleWhenOfflineModeCheck(CardInfo card, out string msg)
        //{

        //    if (AppSettings.CurrentSetting.EnableWriteCard
        //        && !card.OnlineHandleWhenOfflineMode)//脱机模式时,按脱机模式处理
        //    {
        //        if (!DataBaseConnectionsManager.Current.BothCconnectedOrNoStandby)
        //        {
        //            msg = "与主数据库或备用数据库连接失败!";
        //            return false;
        //        }

        //        if (DataBaseConnectionsManager.Current.StandbyConnected)
        //        {
        //            //与备用数据库连接上时,检查主数据库与备用数据库的数据是否一致
        //            CardBll scbll = new CardBll(AppSettings.CurrentSetting.CurrentStandbyConnect);
        //            CardInfo scard = scbll.GetCardByID(card.CardID).QueryObject;
        //            if (scard == null
        //                || scard.ParkingStatus != card.ParkingStatus   //停车状态
        //                || scard.LastDateTime != card.LastDateTime     //最近一次刷卡时间
        //                ||scard.PaidDateTime!=card.PaidDateTime        //缴费时间
        //                ||scard.TotalPaidFee!=card.TotalPaidFee)       //已缴费用
        //            {
        //                msg = "主数据库与备用数据库信息不一致!";
        //                return false;
        //            }
        //        }
        //    }

        //    msg = string.Empty;
        //    return true;

        //}

        /// <summary>
        /// 获取卡片详细信息
        /// </summary>
        /// <param name="offlineHandleCard">是否脱机处理的卡片</param>
        /// <param name="cardID">卡号</param>
        /// <param name="info">从卡片扇区数据中读取到的卡片信息</param>
        /// <param name="card">返回的卡片</param>
        /// <param name="msg">返回的错误信息</param>
        /// <returns></returns>
        private bool GetCardDetail(bool offlineHandleCard, string cardID, CardInfo info, out CardInfo card, out string msg)
        {
            card = null;
            if (DataBaseConnectionsManager.Current.MasterConnected ||
                DataBaseConnectionsManager.Current.StandbyConnected)
            {
                CardInfo mastercard  = null;
                CardInfo standbycard = null;

                if (DataBaseConnectionsManager.Current.MasterConnected)
                {
                    CardBll mcbll = new CardBll(AppSettings.CurrentSetting.CurrentMasterConnect);
                    mastercard = mcbll.GetCardDetail(cardID);
                }

                if (DataBaseConnectionsManager.Current.StandbyConnected)
                {
                    //需要获取备用数据库的卡片信息进行比对
                    //通信工作站如果没有连接上主数据库,需要从备用数据库中获取卡片信息
                    CardBll scbll = new CardBll(AppSettings.CurrentSetting.CurrentStandbyConnect);
                    standbycard = scbll.GetCardDetail(cardID);
                }

                //在线处理的卡片,主数据库连上,有备份数据库的,需要与获取备用数据库的卡片信息进行比对
                if (!offlineHandleCard &&
                    DataBaseConnectionsManager.Current.MasterConnected &&
                    WorkStationInfo.CurrentStation.HasStandbyDatabase)
                {
                    if (mastercard == null && standbycard == null)
                    {
                        //没有该卡片
                    }
                    else if (mastercard == null ||
                             standbycard == null ||
                             !mastercard.CompareChargeInfo(standbycard))
                    {
                        msg = "主数据库与备用数据库信息不一致!";
                        return(false);
                    }
                }

                if (mastercard != null)
                {
                    card = mastercard;
                }
                else if (WorkStationInfo.CurrentStation.IsHostWorkstation || offlineHandleCard)
                {
                    card = standbycard;
                }
            }
            else if (offlineHandleCard)
            {
                //与主数据库和备用连接断开时,如果是脱机处理的卡片,获取的为读到的卡片信息
                card = info.Clone();
            }

            msg = string.Empty;
            return(true);
        }
Esempio n. 19
0
        ////确认查询条件
        //protected void Button_Click(object sender, EventArgs e)
        //{
        //    if (txtName.Text != "卡牌")
        //    {
        //        string card_name = txtName.Text.Trim();
        //        CardView.DataSource = CardBll.namecard(card_name);
        //        CardView.DataBind();
        //    }
        //    else
        //    {
        //        if (DropDownList_cost.SelectedIndex != 0)
        //        {
        //            CardView.DataSource = CardBll.selectcard(DropDownList_off.SelectedItem.Text);
        //            CardView.DataBind();
        //            if (DropDownList_occ.SelectedIndex != 0)
        //            {
        //                CardView.DataSource = CardBll.selectcard(DropDownList_off.SelectedItem.Text, DropDownList_occ.SelectedItem.Text);
        //                CardView.DataBind();
        //                if (DropDownList_cost.SelectedIndex != 0)
        //                {
        //                    CardView.DataSource = CardBll.selectcard(DropDownList_off.SelectedItem.Text, DropDownList_occ.SelectedItem.Text, int.Parse(DropDownList_cost.SelectedItem.Text));
        //                    CardView.DataBind();
        //                    if (DropDownList_Race.SelectedIndex != 0)
        //                    {
        //                        CardView.DataSource = CardBll.selectcard(DropDownList_off.SelectedItem.Text, DropDownList_occ.SelectedItem.Text, int.Parse(DropDownList_cost.SelectedItem.Text), DropDownList_Race.SelectedItem.Text);
        //                        CardView.DataBind();
        //                        if (DropDownList_rd.SelectedIndex != 0)
        //                        {
        //                            CardView.DataSource = CardBll.selectcard(DropDownList_off.SelectedItem.Text, DropDownList_occ.SelectedItem.Text, int.Parse(DropDownList_cost.SelectedItem.Text), DropDownList_Race.SelectedItem.Text, DropDownList_rd.SelectedItem.Text);
        //                            CardView.DataBind();
        //                        }
        //                    }
        //                }
        //            }
        //        }
        //    }

        //}

        //protected void moreselect1_Click(object sender, EventArgs e)
        //{
        //    Panel1.Visible = true;
        //}

        //一级查询
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (DropDownList_off.SelectedIndex != 0)
            {
                CardView.DataSource = CardBll.selectcard(DropDownList_off.SelectedItem.Text);
                CardView.DataBind();
            }
        }
Esempio n. 20
0
 //五级查询
 protected void Button5_Click(object sender, EventArgs e)
 {
     if (DropDownList_rd.SelectedIndex != 0)
     {
         CardView.DataSource = CardBll.selectcard(DropDownList_off.SelectedItem.Text, DropDownList_occ.SelectedItem.Text, int.Parse(DropDownList_cost.SelectedItem.Text), DropDownList_Race.SelectedItem.Text, DropDownList_rd.SelectedItem.Text);
         CardView.DataBind();
     }
 }
Esempio n. 21
0
        /// <summary>
        /// 读取到卡号处理
        /// </summary>
        /// <param name="cardID">卡号</param>
        /// <param name="info">从卡片扇区数据中读取到的卡片信息</param>
        private void ReadCardIDHandler(string cardID, CardInfo info)
        {
            this.txtCardID.Text = cardID;
            CardBll  bll  = new CardBll(AppSettings.CurrentSetting.ParkConnect);
            CardInfo card = bll.GetCardByID(cardID).QueryObject;

            ShowCardInfo(card, cardID);
        }
Esempio n. 22
0
 protected void Button_Click(object sender, EventArgs e)
 {
     if (txtName.Text != "卡牌")
     {
         string card_name = txtName.Text.Trim();
         CardView.DataSource = CardBll.namecard(card_name);
         CardView.DataBind();
     }
 }
Esempio n. 23
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!CheckInput())
            {
                return;
            }

            CardBll       bll = new CardBll(AppSettings.CurrentSetting.ParkConnect);
            CommandResult result;

            if (LossRestoreCard.Status == CardStatus.Loss)
            {
                result = bll.CardRestore(LossRestoreCard, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard);
            }
            else
            {
                if (chkPayParkFee.Checked && _ParkPayment != null)
                {
                    _ParkPayment.Paid     = txtParkFee.DecimalValue;
                    _ParkPayment.Discount = _ParkPayment.Accounts - _ParkPayment.Paid;
                    result = bll.CardLoss(LossRestoreCard, this.txtMemo.Text, txtCardCost.DecimalValue, comPaymentMode.SelectedPaymentMode, _ParkPayment);
                }
                else
                {
                    result = bll.CardLoss(LossRestoreCard, this.txtMemo.Text, txtCardCost.DecimalValue, comPaymentMode.SelectedPaymentMode);
                }
            }
            if (result.Result == ResultCode.Successful)
            {
                //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消
                if (this.chkWriteCard.Checked)
                {
                    //恢复时才将卡片信息写入,挂失时不写入
                    if (LossRestoreCard.Status == CardStatus.Enabled)
                    {
                        CardOperationManager.Instance.WriteCardLoop(LossRestoreCard);
                    }
                }

                if (this.ItemUpdated != null)
                {
                    this.ItemUpdated(this, new ItemUpdatedEventArgs(LossRestoreCard));
                }

                if (DataBaseConnectionsManager.Current.StandbyConnected)
                {
                    //备用数据连上时,同步到备用数据库
                    bll.SyncCardToDatabaseWithoutPaymentInfo(LossRestoreCard, AppSettings.CurrentSetting.CurrentStandbyConnect);
                }

                this.Close();
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
Esempio n. 24
0
        private CardInfo _OriginalCard; //卡片原始信息

        #region 私有方法
        /// <summary>
        /// 读取到卡号处理
        /// </summary>
        /// <param name="cardID">卡号</param>
        /// <param name="info">从卡片扇区数据中读取到的卡片信息</param>
        private void ReadCardIDHandler(string cardID, CardInfo info)
        {
            txtCardID.TextChanged  -= txtCardID_TextChanged;
            this.txtCardID.Text     = cardID;
            this.txtCardID.ReadOnly = true;
            string msg = string.Empty;
            bool   offlineHandleCard = AppSettings.CurrentSetting.EnableWriteCard &&
                                       info != null &&
                                       !info.OnlineHandleWhenOfflineMode;
            CardBll bll = new CardBll(AppSettings.CurrentSetting.CurrentMasterConnect);
            //如果只是免费授权,卡片信息只要从主数据库获取就可以了
            CardInfo card = bll.GetCardDetail(cardID);

            if (card == null && offlineHandleCard)
            {
                card = info.Clone();
            }

            if (!WorkStationInfo.CurrentStation.CanFreeAuthorization(offlineHandleCard, out msg))
            {
                //该工作站不能进行授权
            }
            else if (card == null)
            {
                msg = CardInvalidDescripition.GetDescription(EventInvalidType.INV_UnRegister);
            }
            else if (AppSettings.CurrentSetting.EnableWriteCard &&
                     !card.OnlineHandleWhenOfflineMode &&
                     !CardDateResolver.Instance.CopyPaidDataToCard(card, info))//只复制缴费相关的信息,如果复制了所有的信息,会覆盖数据库内的卡片状态,如挂失,禁用等状态
            //&& !CardDateResolver.Instance.CopyCardDataToCard(card, info))
            {
                //写卡模式时,卡片信息从扇区数据中获取
                msg = Resource1.FrmCardCenterCharge_CardDataErr;
            }
            else if (!ValidateCard(card, out msg))
            {
                //卡片无效
            }
            else
            {
                _cardInfo     = card;
                _OriginalCard = card.Clone();
                ShowCardInfo(_cardInfo);
            }
            if (!string.IsNullOrEmpty(msg))
            {
                if (AppSettings.CurrentSetting.EnableTTS)
                {
                    TTSSpeech.Instance.Speek(msg);
                }
                ClearInput();
                this.txtCardID.Text = cardID;
                MessageBox.Show(msg);
            }
            txtCardID.TextChanged += txtCardID_TextChanged;
        }
Esempio n. 25
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            ReleasingCard = this.ucCard1.Card;
            if (ReleasingCard != null)
            {
                if (CheckInput())
                {
                    if (txtRecieveMoney.DecimalValue <= 0)
                    {
                        if (MessageBox.Show(Resources.Resource1.FrmCardPaying_MoneyLittleQuery, Resources.Resource1.Form_Alert,
                                            MessageBoxButtons.YesNo) == DialogResult.No)
                        {
                            return;
                        }
                    }

                    CardBll       bll    = new CardBll(AppSettings.CurrentSetting.ParkConnect);
                    CommandResult result = bll.CardRelease(ReleasingCard, txtRecieveMoney.DecimalValue, comPaymentMode.SelectedPaymentMode, txtMemo.Text.Trim());
                    if (result.Result == ResultCode.Successful)
                    {
                        //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消
                        if (this.chkWriteCard.Checked)
                        {
                            CardOperationManager.Instance.WriteCardLoop(ReleasingCard);
                        }

                        if (!_isAdding)
                        {
                            if (ItemUpdated != null)
                            {
                                ItemUpdated(this, new ItemUpdatedEventArgs(ReleasingCard));
                            }
                        }
                        else
                        {
                            if (ItemAdded != null)
                            {
                                ItemAdded(this, new ItemAddedEventArgs(ReleasingCard));
                            }
                        }
                        this.ucCard1.Clear();
                        this.txtRecieveMoney.DecimalValue = 0;

                        if (DataBaseConnectionsManager.Current.StandbyConnected)
                        {
                            //备用数据连上时,同步到备用数据库
                            bll.SyncCardToDatabaseWithoutPaymentInfo(ReleasingCard, AppSettings.CurrentSetting.CurrentStandbyConnect);
                        }
                    }
                    else
                    {
                        MessageBox.Show(result.Message);
                    }
                }
            }
        }
Esempio n. 26
0
        private void ReadCardSuccess_Handler(string cardID)
        {
            CardBll bll = new CardBll(AppSettings.CurrentSetting.ParkConnect);

            if (bll.GetCardByID(cardID).Result == ResultCode.Successful)
            {
                lblAlarm.Text      = string.Format(Resources.Resource1.FrmAddCards_CardExists, cardID);
                lblAlarm.ForeColor = Color.Red;
                return; //如果卡片已经存在什么也不做
            }
            if (cardView.IndexOfCard(cardID) == -1)
            {
                CardInfo card = new CardInfo();
                card.CardID                      = cardID;
                card.CardType                    = this.comCardType.SelectedCardType;
                card.AccessID                    = (byte)this.comAccessLevel.AccesslevelID;
                card.Balance                     = this.txtBalance.DecimalValue;
                card.ValidDate                   = this.dtValidDate.Value;
                card.CarType                     = this.comChargeType.SelectedCarType;
                card.Status                      = CardStatus.Enabled;
                card.CanRepeatIn                 = this.chkRepeatIn.Checked;
                card.CanRepeatOut                = this.chkRepeatOut.Checked;
                card.HolidayEnabled              = this.chkHoliday.Checked;
                card.WithCount                   = this.chkWithCount.Checked;
                card.CanEnterWhenFull            = this.chkCanEnterWhenFull.Checked;
                card.EnableWhenExpired           = this.chkEnableWhenExpired.Checked;
                card.OnlineHandleWhenOfflineMode = this.chkOnlineHandleWhenOfflineMode.Checked;
                card.OwnerName                   = string.Format("{0}{1}{2}", this.txtPrefix.Text.Trim(),
                                                                 chkAutoIncrement.Checked ? (txtAutoIncrement.IntergerValue + cardView.Rows.Count).ToString() : string.Empty,
                                                                 txtSuffix.Text.Trim());

                //如果是写卡模式,这里需将信息写入卡片成功后才能继续
                if (this.chkWriteCard.Checked)
                {
                    lblAlarm.Text      = string.Format(Resources.Resource1.FrmAddCards_WritingCard, cardID);
                    lblAlarm.ForeColor = Color.Blue;
                    lblAlarm.Refresh();

                    //密钥不正确的,需要初始化密钥
                    if (CardOperationManager.Instance.WriteCardLoop(card, true) != CardOperationResultCode.Success)
                    {
                        lblAlarm.Text      = string.Format(Resources.Resource1.FrmAddCards_WriteCardFail, cardID);
                        lblAlarm.ForeColor = Color.Red;
                        return;//如果卡片信息写入失败什么也不做
                    }
                }
                cardView.AddCardInfo(card);
                cardView.SelectedCard(card.CardID);
                lblAlarm.Text      = string.Format(Resources.Resource1.FrmAddCards_CardCount, cardView.Rows.Count);
                lblAlarm.ForeColor = Color.Blue;
            }
            else
            {
                cardView.SelectedCard(cardID);
            }
        }
Esempio n. 27
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (DeferingCard != null)
            {
                if (CheckInput())
                {
                    if (txtRecieveMoney.DecimalValue <= 0)
                    {
                        if (MessageBox.Show(Resource1.FrmCardPaying_MoneyLittleQuery, Resource1.Form_Alert, MessageBoxButtons.YesNo) == DialogResult.No)
                        {
                            return;
                        }
                    }

                    //写卡模式时,先读取卡片信息
                    if (this.chkWriteCard.Checked)
                    {
                        if (!CardOperationManager.Instance.CheckCardWithMessage(DeferingCard.CardID))
                        {
                            return;
                        }
                    }

                    CardBll       bll          = new CardBll(AppSettings.CurrentSetting.ParkConnect);
                    decimal       recieveMoney = this.txtRecieveMoney.DecimalValue;
                    DateTime      newValidDate = this.dtEnd.Value.Date.AddDays(1).AddSeconds(-1);
                    DateTimeRange dr           = new DateTimeRange(dtBegin.Value, dtEnd.Value);
                    CommandResult result       = bll.CardDefer(DeferingCard, dr, this.comPaymentMode.SelectedPaymentMode, recieveMoney, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard);//写卡模式不需要保持卡片数据库中的运行状态
                    if (result.Result == ResultCode.Successful)
                    {
                        //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消
                        if (this.chkWriteCard.Checked)
                        {
                            CardOperationManager.Instance.WriteCardLoop(DeferingCard);
                        }

                        if (ItemUpdated != null)
                        {
                            ItemUpdated(this, new ItemUpdatedEventArgs(DeferingCard));
                        }

                        if (DataBaseConnectionsManager.Current.StandbyConnected)
                        {
                            //备用数据连上时,同步到备用数据库
                            bll.SyncCardToDatabaseWithoutPaymentInfo(DeferingCard, AppSettings.CurrentSetting.CurrentStandbyConnect);
                        }

                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(result.Message);
                    }
                }
            }
        }
Esempio n. 28
0
        /// <summary>
        /// 装换到数据库
        /// </summary>
        /// <param name="card"></param>
        /// <returns></returns>
        private bool ConvertToDatabase(CardInfo card)
        {
            bool success = false;

            if (card != null)
            {
                success = new CardBll(AppSettings.CurrentSetting.ParkConnect).UpdateCardAll(card).Result == ResultCode.Successful;
            }
            return(success);
        }
Esempio n. 29
0
        /// <summary>
        /// 读取到卡号处理
        /// </summary>
        /// <param name="cardID">卡号</param>
        /// <param name="info">从卡片扇区数据中读取到的卡片信息</param>
        private void ReadCardIDHandler(string cardID, CardInfo info)
        {
            this.txtCardID.Text = cardID;
            CardBll  bll  = new CardBll(AppSettings.CurrentSetting.ParkConnect);
            CardInfo card = bll.GetCardByID(cardID).QueryObject;

            this.lbl_HasHour.Text = string.Empty;//每次读卡都清空已录入优惠时数

            ShowCardInfo(card);
        }
Esempio n. 30
0
        protected override CommandResult UpdateItem(object updatingItem)
        {
            CardInfo      card   = (CardInfo)updatingItem;
            CardBll       bll    = new CardBll(AppSettings.CurrentSetting.ParkConnect);
            CommandResult result = bll.UpdateCardAll(card);

            if (result.Result == ResultCode.Successful)
            {
                WriteCard(card);
            }
            return(result);
        }