Ejemplo n.º 1
0
        /// <summary>
        /// 删除选中行数据的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeleteReadInfo()
        {
            try
            {
                int j = 0;
                if (this.dgvCarAttribute.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int    count = dgvCarAttribute.SelectedRows.Count;
                        string id    = "";
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            Expression <Func <CardInfo, bool> > funuserinfo = n => n.CardInfo_ID == int.Parse(this.dgvCarAttribute.SelectedRows[i].Cells["CardInfo_ID"].Value.ToString());

                            if (!CardInfoDAL.DeleteToMany(funuserinfo))
                            {
                                j++;
                            }
                        }
                        if (j == 0)
                        {
                            MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            LogInfoLoad("");
                        }
                        else
                        {
                            MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        string strContent = "IC卡编号:" + this.dgvCarAttribute.SelectedRows[0].Cells["Driveway_ID"].Value.ToString();
                        CommonalityEntity.WriteLogData("删除", strContent, CommonalityEntity.USERNAME);//添加操作日志
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("刷卡记录查询 DeleteReadInfo() 异常!+");
            }
            finally
            {
                LogInfoLoad("");
            }
        }
Ejemplo n.º 2
0
        public CardInfoDTO CardInfo(int id)
        {
            CardInfoDAL adal = new CardInfoDAL();

            return(adal.CardInfo(id));
        }