Esempio n. 1
0
        private void Dgv_ManageList_SelectionChanged(object sender, EventArgs e)
        {
            if (dgv_ManageList.SelectedRows.Count == 0)
            {
                return;
            }
            int          index       = 0;
            CbManageInfo mManageInfo = FormComm.GetDataSourceToClass <CbManageInfo>(dgv_ManageList, ref index);

            if (mManageInfo.ManageType == 0)
            {
                btn_Del.Enabled            = false;
                btn_Edit.Enabled           = false;
                btn_ChangePassword.Enabled = Dal_ManageInfo.ManageInfo.ManageType == 0;
                btn_Jurisdiction.Enabled   = false;
            }
            else if (mManageInfo.ID == Dal_ManageInfo.ManageInfo.ID)
            {
                btn_Del.Enabled            = false;
                btn_ChangePassword.Enabled = true;
                btn_Edit.Enabled           = true;
                btn_Jurisdiction.Enabled   = false;
            }
            else
            {
                btn_Del.Enabled            = Dal_ManageRights.ManageRights.SetUserManagementToDelete;
                btn_Edit.Enabled           = Dal_ManageRights.ManageRights.SetUserManagemenetEditor;
                btn_ChangePassword.Enabled = Dal_ManageInfo.ManageInfo.ManageType == 0;
                btn_Jurisdiction.Enabled   = Dal_ManageRights.ManageRights.SetUserAdministrationRights;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// DGV 单击单元格内容
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Dgv_DataList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            if (!(dgv_DataList.Columns[e.ColumnIndex] is DataGridViewButtonColumn))
            {
                return;
            }
            int             index          = 0;
            CbAssociateCard mAssociateCard = FormComm.GetDataSourceToClass <CbAssociateCard>(dgv_DataList, ref index);

            //单个延期
            using (DelayParam_Form delayparam = new DelayParam_Form(mAssociateCard))
            {
                if (delayparam.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                mAssociateCard = delayparam.Tag as CbAssociateCard;
                if (mAssociateCard.AssociateCardTime.Date != mAssociateCard.UpdateTime.Date)
                {
                    mAssociateCard.UseState = 3;
                }
                //更新列表中的显示
                FormComm.UpdateDgvDataSource <CbAssociateCard>(mAssociateCard, dgv_DataList, index);
            }
        }
Esempio n. 3
0
        private void Btn_Del_Click(object sender, EventArgs e)
        {
            int          index      = 0;
            CbDeviceInfo deviceinfo = FormComm.GetDataSourceToClass <CbDeviceInfo>(dgv_DeviceInfo, ref index);

            if (MessageBox.Show("确认是否删除设备信息。", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
            {
                try
                {
                    Dbhelper.Db.Del <CbDeviceInfo>(deviceinfo.ID);
                    DataTable dt = dgv_DeviceInfo.DataSource as DataTable;
                    dt.Rows.RemoveAt(index);
                    GetDeviceInfoCount();
                    if (cb_AllSelected.CheckState != CheckState.Unchecked)
                    {
                        cb_AllSelected.CheckState = CheckState.Unchecked;
                        btn_Export.Enabled        = false;
                    }
                }
                catch (Exception ex)
                {
                    CustomExceptionHandler.GetExceptionMessage(ex);
                    MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 4
0
        private void Btn_Edit_Click(object sender, EventArgs e)
        {
            int        index     = 0;
            CbCardInfo mCardInfo = FormComm.GetDataSourceToClass <CbCardInfo>(dgv_InfoList, ref index);

            using (EditInfo_Form edit = new EditInfo_Form(mCardInfo))
            {
                if (edit.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                mCardInfo = edit.Tag as CbCardInfo;
                FormComm.UpdateDgvDataSource <CbCardInfo>(mCardInfo, dgv_InfoList, index);
            }
        }
Esempio n. 5
0
        private void Btn_ChangePassword_Click(object sender, EventArgs e)
        {
            int          index       = 0;
            CbManageInfo mManageInfo = FormComm.GetDataSourceToClass <CbManageInfo>(dgv_ManageList, ref index);

            using (ChangePassword_Form changepassword = new ChangePassword_Form(mManageInfo))
            {
                if (changepassword.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                mManageInfo = changepassword.Tag as CbManageInfo;
                FormComm.UpdateDgvDataSource <CbManageInfo>(mManageInfo, dgv_ManageList, index);
            }
        }
Esempio n. 6
0
        private void Btn_Edit_Click(object sender, EventArgs e)
        {
            int          index       = 0;
            CbManageInfo mManageInfo = FormComm.GetDataSourceToClass <CbManageInfo>(dgv_ManageList, ref index);

            using (EditManager_Form editmanage = new EditManager_Form(mManageInfo))
            {
                if (editmanage.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                mManageInfo = editmanage.Tag as CbManageInfo;
                FormComm.UpdateDgvDataSource <CbManageInfo>(mManageInfo, dgv_ManageList, index);
            }
        }
Esempio n. 7
0
        private void Btn_Jurisdiction_Click(object sender, EventArgs e)
        {
            int          index       = 0;
            CbManageInfo mManageInfo = FormComm.GetDataSourceToClass <CbManageInfo>(dgv_ManageList, ref index);

            using (JurisdictionSettings_Form jurisdiction = new JurisdictionSettings_Form(mManageInfo))
            {
                if (jurisdiction.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                GetManageInfo();
                dgv_ManageList.Rows[index].Selected = true;
            }
        }
Esempio n. 8
0
        private void Btn_Edit_Click(object sender, EventArgs e)
        {
            int          index       = 0;
            CbDeviceInfo mDeviceInfo = FormComm.GetDataSourceToClass <CbDeviceInfo>(dgv_DeviceInfo, ref index);

            using (EditDeviceInfo_Form editdeviceinfo = new CbznSystem.EditDeviceInfo_Form(mDeviceInfo))
            {
                if (editdeviceinfo.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                mDeviceInfo = editdeviceinfo.Tag as CbDeviceInfo;
                FormComm.UpdateDgvDataSource <CbDeviceInfo>(mDeviceInfo, dgv_DeviceInfo, index);
            }
        }
Esempio n. 9
0
        private List <CbDeviceInfo> GetSelectRow()
        {
            List <CbDeviceInfo> mDeviceInfos = new List <CbDeviceInfo>();

            for (int i = 0; i < dgv_DeviceInfo.RowCount; i++)
            {
                bool flag = Utils.StrToBool(dgv_DeviceInfo["c_Selected", i].Value, false);
                if (!flag)
                {
                    continue;
                }
                CbDeviceInfo mDeviceInfo = FormComm.GetDataSourceToClass <CbDeviceInfo>(dgv_DeviceInfo, i);
                mDeviceInfos.Add(mDeviceInfo);
            }
            return(mDeviceInfos);
        }
Esempio n. 10
0
        /// <summary>
        /// 批量延期
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Delays_Click(object sender, EventArgs e)
        {
            //获取选择批量延期的副卡
            List <CbAssociateCard> mAssociateCards = new List <CbAssociateCard>();

            for (int i = 0; i < dgv_DataList.RowCount; i++)
            {
                bool flag = Utils.StrToBool(dgv_DataList["c_Selected", i].Value, false);
                if (!flag)
                {
                    continue;
                }
                CbAssociateCard mAssociateCard = FormComm.GetDataSourceToClass <CbAssociateCard>(dgv_DataList, i);
                mAssociateCards.Add(mAssociateCard);
            }
            using (DelayParam_Form delayparam = new DelayParam_Form(mAssociateCards))
            {
                if (delayparam.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                mAssociateCards = delayparam.Tag as List <CbAssociateCard>;
                //延期后的时间和车牌分区显示在列表中
                foreach (CbAssociateCard item in mAssociateCards)
                {
                    for (int i = 0; i < dgv_DataList.RowCount; i++)
                    {
                        if (dgv_DataList["AssociateCardNumber", i].Value.Equals(item.AssociateCardNumber))
                        {
                            if (item.AssociateCardTime.Date != item.UpdateTime.Date)
                            {
                                item.UseState = 3;
                            }
                            //更新列表中的显示
                            FormComm.UpdateDgvDataSource <CbAssociateCard>(item, dgv_DataList, i);
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 11
0
        private void Btn_Del_Click(object sender, EventArgs e)
        {
            int        index     = 0;
            CbCardInfo mCardInfo = FormComm.GetDataSourceToClass <CbCardInfo>(dgv_InfoList, ref index);

            if (MessageBox.Show("确认删除用户:" + mCardInfo.UserName + " 的信息吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) != DialogResult.OK)
            {
                return;
            }
            try
            {
                Dbhelper.Db.Del <CbCardInfo>(mCardInfo.ID);
                GetRecordCount();
                //DataTable dt = dgv_InfoList.DataSource as DataTable;
                //dt.Rows.RemoveAt(index);
            }
            catch (Exception ex)
            {
                CustomExceptionHandler.GetExceptionMessage(ex);
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 12
0
        private void Btn_Del_Click(object sender, EventArgs e)
        {
            int          index       = 0;
            CbManageInfo mManageInfo = FormComm.GetDataSourceToClass <CbManageInfo>(dgv_ManageList, ref index);

            if (MessageBox.Show("确认删除管理员:" + mManageInfo.UserName + "", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) != DialogResult.OK)
            {
                return;
            }
            try
            {
                Dbhelper.Db.Del <CbManageInfo>(mManageInfo.ID);
                Dbhelper.Db.Del <CbManageRights>(" and UserID=" + mManageInfo.ID);
                DataTable dt = dgv_ManageList.DataSource as DataTable;
                dt.Rows.RemoveAt(index);
                dgv_ManageList.Rows[0].Selected = true;
            }
            catch (Exception ex)
            {
                CustomExceptionHandler.GetExceptionMessage(ex);
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 确认
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Enter_Click(object sender, EventArgs e)
        {
            btn_Enter.Enabled = false;
            byte[] by = null;
            try
            {
                if (_mCardCounting == null)
                {
                    //获取主卡计数数据
                    _mCardCounting = Dbhelper.Db.FirstDefault <CbCardCountingState>(string.Format(" and UseNumber='{0}' ", _mCardInfo.CardNumber));
                    //当前计数+1
                    _mCardCounting.UseCounting = DistanceCardHelper.LimitCount(_mCardCounting.UseCounting);
                }
                //获取副卡集合
                _mViceCard = new List <CbAssociateCard>();
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < dgv_DataList.RowCount; i++)
                {
                    CbAssociateCard mvicecard = FormComm.GetDataSourceToClass <CbAssociateCard>(dgv_DataList, i);
                    _mViceCard.Add(mvicecard);
                    sb.AppendFormat(" UseNumber='{0}' or", mvicecard.AssociateCardNumber);
                }
                if (sb.Length > 0)
                {
                    sb = sb.Remove(sb.Length - 2, 2);
                }

                if (_mViceCardCounting == null && _mCardInfo.CardType == (int)CardTypes.CombinationCard)
                {
                    //获取副卡的计数数据
                    _mViceCardCounting = Dbhelper.Db.ToList <CbCardCountingState>(string.Format(" and ({0}) ", sb.ToString()));
                    List <CombinationCardViceCardDataParam> ViceCardParams = new List <CombinationCardViceCardDataParam>();
                    foreach (CbCardCountingState item in _mViceCardCounting)
                    {
                        //副卡计数+1
                        item.UseCounting = DistanceCardHelper.LimitCount(item.UseCounting);
                        //获取副卡
                        CbAssociateCard vicecard = GetViceCard(item.UseNumber);
                        ViceCardParams.Add(new CombinationCardViceCardDataParam()
                        {
                            ViceCardCount     = item.UseCounting,
                            ViceCardNumber    = item.UseNumber,
                            ViceCardPartition = vicecard.SubCardDivision,
                            ViceCardTime      = vicecard.UpdateTime
                        });
                    }
                    by = DistanceCardHelper.SetDistanceData(_mCardInfo.CardNumber, _mCardCounting.UseCounting, ViceCardParams);
                }
                else //车牌识别卡
                {
                    List <LprCardViceCardParam> ViceCardParams = new List <LprCardViceCardParam>();
                    foreach (CbAssociateCard item in _mViceCard)
                    {
                        ViceCardParams.Add(new LprCardViceCardParam()
                        {
                            PlateNumber       = item.AssociateCardNumber,
                            ViceCardPartition = item.SubCardDivision,
                            ViceCardTime      = item.UpdateTime
                        });
                    }
                    by = DistanceCardHelper.SetDistanceData(_mCardInfo.CardNumber, _mCardCounting.UseCounting, ViceCardParams);
                }
                PortHelper.SerialPortWrite(by);
                StartTimeOutThread();
            }
            catch (Exception ex)
            {
                btn_Enter.Enabled = true;
                CustomExceptionHandler.GetExceptionMessage(ex);
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }