예제 #1
0
        /// <summary>
        /// 回调方法-配置器当扇区重置返回时
        /// </summary>
        private void SelChsForm_OnChsCleanReponse(uint iCardNo, string strErrInfo)
        {
            if (string.IsNullOrEmpty(strErrInfo))
            {
                try
                {
                    this.Invoke(new EventHandler(delegate
                    {
                        //CMessageBox.ShowSucc(string.Format("恭喜您,扇区重置成功!"), Config.DialogTitle);
                        //字体颜色恢复默认
                        rbList[_rbInt].ForeColor = Color.Black;
                        _ChsCleanList.Remove(_rbInt);
                        btnChsClean.Text = "扇区选择";

                        //删除数据库卡片数据
                        IDAL.ICard objDAL = DALFactory.DALFactory.Card();
                        IList <CardManage.Model.Card> CleanCard = objDAL.GetListByWhere(1, string.Format("cardno = {0}", iCardNo));
                        if (CleanCard.Count > 0 && !objDAL.Delete(CleanCard[0].ID))
                        {
                            CMessageBox.ShowError(string.Format("恭喜您,扇区重置成功,但是删除数据库卡片数据失败!"), Config.DialogTitle);
                            return;
                        }

                        CMessageBox.ShowSucc(string.Format("恭喜您,扇区重置和保存卡片数据到数据库都成功!"), Config.DialogTitle);
                    }));
                }
                catch { }
            }
            else
            {
                CMessageBox.ShowError(string.Format("操作失败,错误原因如下:\r\n{0}", strErrInfo), Config.DialogTitle);
            }
        }
예제 #2
0
        /// <summary>
        /// 绑定数据到列表
        /// </summary>
        /// <param name="selNum">数据条数</param>
        /// <param name="sqlWhereAndOrderBy">条件</param>
        protected override void BindLVData(int selNum = 0, string sqlWhereAndOrderBy = null)
        {
            this.lvContent.BeginUpdate();
            this.lvContent.Items.Clear();
            try
            {
                if (selNum <= 0)
                {
                    selNum = this.DefaultPageSize;
                }
                if (string.IsNullOrEmpty(sqlWhereAndOrderBy) || sqlWhereAndOrderBy.Equals(""))
                {
                    sqlWhereAndOrderBy = "1=1";
                }
                this.CurrentSqlWhere = sqlWhereAndOrderBy;

                IList <Card> listData = null;
                IDAL.ICard   objDAL   = DALFactory.DALFactory.Card();
                listData = objDAL.GetListByWhere(selNum, sqlWhereAndOrderBy);
                if (!(listData == null || listData.Count <= 0))
                {
                    foreach (Card model in listData)
                    {
                        //序号,50|卡号,80|卡片类型,70|小区编码,60|楼栋编码,60|单元编码,60|房间编码,80|卡片系列号,210|卡片有效期,100|发卡时间,100|持卡者姓名,100|联系电话,100|所在房间,100|所在单元,100|所在楼栋,100|所在小区,120
                        ListViewItem item = new ListViewItem(new string[] { Convert.ToString(lvContent.Items.Count + 1), model.CardNo.ToString(), model.CardTypeDesc, FormatBuildingCode(model.RAreaCode), FormatBuildingCode(model.RBuildCode), FormatBuildingCode(model.RUnitCode), FormatRoomCode(model.RRoomCode), model.SerialNo, Functions.ConvertToNormalTime(model.ExpiryDate).ToString(Config.TimeFormat), Functions.ConvertToNormalTime(model.CreateDate).ToString(Config.TimeFormat), model.Contact, model.Tel,
                                                                            model.RoomName, model.UnitName, model.BuildName, model.AreaName })
                        {
                            Tag  = model,
                            Font = new Font("宋体", 9, FontStyle.Regular)
                        };
                        this.lvContent.Items.Add(item);
                    }
                }
            }
            catch (Exception err)
            {
                CMessageBox.ShowWaring(string.Format("系统错误,错误如下:\r\n{0}!", err.Message), Config.DialogTitle);
            }
            this.lvContent.EndUpdate();
        }