Exemplo n.º 1
0
        /// <summary>
        /// 查看选中团号,可以移出团号里的人
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmsItemShowGroupNo_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count > 1)
            {
                MessageBoxEx.Show(Resources.SelectShowMoreThanOne);
                return;
            }

            Model.Visa model = _bllVisa.GetModel((Guid)dataGridView1.SelectedRows[0].Cells["Visa_id"].Value);
            if (model == null)
            {
                MessageBoxEx.Show(Resources.FindModelFailedPleaseCheckInfoCorrect);
                return;
            }

            if (model.Types == Common.Enums.Types.Individual)
            {
                FrmSetGroup frm = new FrmSetGroup(model, LoadDataToDataGridView, _curPage);
                frm.ShowDialog();
            }
            else if (model.Types == Common.Enums.Types.Team)
            {
                FrmSetTeamVisaGroup frm = new FrmSetTeamVisaGroup(model, LoadDataToDataGridView, _curPage);
                frm.ShowDialog();
            }
        }
Exemplo n.º 2
0
        private void AddToSelectGroup()
        {
            if (MessageBoxEx.Show("是否添加到选中团号?", "确认", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }
            //执行添加到团号的逻辑
            Model.Visa visaModel = _bllVisa.GetModel(Guid.Parse(dataGridView1.SelectedRows[0].Cells["Visa_id"].Value.ToString()));
            //
            for (int i = 0; i != _listToAddToGroup.Count; ++i)
            {
                _listToAddToGroup[i].Visa_id = visaModel.Visa_id.ToString();
                _listToAddToGroup[i].GroupNo = visaModel.GroupNo;
                _listToAddToGroup[i].Types   = visaModel.Types;
            }


            //更新团号的人数
            visaModel.Number += _listToAddToGroup.Count;
            if (visaModel.Types == Common.Enums.Types.Individual)
            {
                if (MessageBoxEx.Show("是否自动更新团号名称?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    visaModel.GroupNo += "、";
                    for (int i = 0; i < _listToAddToGroup.Count; ++i)
                    {
                        visaModel.GroupNo += _listToAddToGroup[i].Name;
                        if (i == _listToAddToGroup.Count - 1)
                        {
                            break;
                        }
                        visaModel.GroupNo += "、";
                    }

                    for (int i = 0; i < _listToAddToGroup.Count; ++i)
                    {
                        _listToAddToGroup[i].GroupNo = visaModel.GroupNo;
                    }
                }
            }

            int n = _bllVisaInfo.UpdateByList(_listToAddToGroup);

            MessageBoxEx.Show(n.ToString() + "条记录更新成功," + (_listToAddToGroup.Count - n) + "条记录更新失败!");

            if (!_bllVisa.Update(visaModel))
            {
                MessageBoxEx.Show("更新团号信息失败!");
                return;
            }
            //之后询问用户是否重新设置资料
            if (MessageBoxEx.Show("是否进入资料设置?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (visaModel.Types == Common.Enums.Types.Individual)
                {
                    FrmSetGroup frm = new FrmSetGroup(visaModel, this.LoadDataToDataGridView, _curPage);
                    frm.ShowDialog();
                }
                else if (visaModel.Types == Common.Enums.Types.Team)
                {
                    FrmSetTeamVisaGroup frm = new FrmSetTeamVisaGroup(visaModel, this.LoadDataToDataGridView, _curPage);
                    frm.ShowDialog();
                }
            }
            this.Close();
        }