Beispiel #1
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);
            }
        }
Beispiel #2
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;
                        }
                    }
                }
            }
        }