コード例 #1
0
ファイル: SelChsForm.cs プロジェクト: ninwjf/MJ-mysqlGS
        /// <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
ファイル: CardManageForm.cs プロジェクト: ninwjf/MJ-mysqlGS
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="selectedItems">当前选择的行项</param>
        protected override void OnDelete(ListView.SelectedListViewItemCollection selectedItems)
        {
            if (MessageBox.Show(string.Format("确定要删除当前选择的卡片信息吗?"), Config.DialogTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            int iSuccNum  = 0;
            int iFaultNum = 0;

            foreach (ListViewItem selectedItem in selectedItems)
            {
                Card       objModel = (Card)selectedItem.Tag;
                IDAL.ICard objDal   = DALFactory.DALFactory.Card();
                if (objDal.Delete(objModel.ID))
                {
                    iSuccNum++;
                }
                else
                {
                    iFaultNum++;
                }
            }

            if (iSuccNum > 0)
            {
                //重新刷新列表
                BindLVData(0, this.CurrentSqlWhere);
            }

            if (iSuccNum == 0)
            {
                CMessageBox.ShowError("对不起,删除失败!", Config.DialogTitle);
            }
            else if (iFaultNum == 0)
            {
                CMessageBox.ShowSucc("恭喜您,删除成功!", Config.DialogTitle);
            }
            else
            {
                CMessageBox.ShowSucc(string.Format("{0}个删除成功,{1}个删除失败", iSuccNum, iFaultNum), Config.DialogTitle);
            }
        }