예제 #1
0
        private void butCombine_Click(object sender, System.EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 2)
            {
                MessageBox.Show(Lan.g(this, "Please select multiple items first while holding down the control key."));
                return;
            }
            if (MessageBox.Show(Lan.g(this, "Combine all these carriers into a single carrier? This will affect all patients using these carriers.  The next window will let you select which carrier to keep when combining."), ""
                                , MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }
            List <long> pickedCarrierNums = new List <long>();

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                pickedCarrierNums.Add(PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["CarrierNum"].ToString()));
            }
            FormCarrierCombine FormCB = new FormCarrierCombine();

            FormCB.CarrierNums = pickedCarrierNums;
            FormCB.ShowDialog();
            if (FormCB.DialogResult != DialogResult.OK)
            {
                return;
            }
            changed = true;
            //int[] combCarrierNums=new int[tbCarriers.SelectedIndices.Length];
            //for(int i=0;i<tbCarriers.SelectedIndices.Length;i++){
            //	carrierNums[i]=Carriers.List[tbCarriers.SelectedIndices[i]].CarrierNum;
            //}
            try{
                //Prepare audit trail entry data, then combine, then make audit trail entries if successful
                List <string>       carrierNames = new List <string>();
                List <List <long> > insPlanNums  = new List <List <long> >();
                string carrierTo = Carriers.GetName(FormCB.PickedCarrierNum);
                for (int i = 0; i < pickedCarrierNums.Count; i++)
                {
                    carrierNames.Add(Carriers.GetName(pickedCarrierNums[i]));
                    insPlanNums.Add(InsPlans.GetPlanNumsByCarrierNum(pickedCarrierNums[i]));
                }
                Carriers.Combine(pickedCarrierNums, FormCB.PickedCarrierNum);
                //Carriers were combined successfully. Loop through all the associated insplans and make a securitylog entry that their carrier changed.
                for (int i = 0; i < insPlanNums.Count; i++)
                {
                    for (int j = 0; j < insPlanNums[i].Count; j++)
                    {
                        SecurityLogs.MakeLogEntry(Permissions.InsPlanChangeCarrierName, 0, Lan.g(this, "Carrier with name ") + " " + carrierNames[i] + " "
                                                  + Lan.g(this, "was merged with") + " " + carrierTo, insPlanNums[i][j]);
                    }
                }
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FillGrid();
        }
예제 #2
0
        private void butCombine_Click(object sender, System.EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 2)
            {
                MessageBox.Show(Lan.g(this, "Please select multiple items first while holding down the control key."));
                return;
            }
            if (MessageBox.Show(Lan.g(this, "Combine all these carriers into a single carrier? This will affect all patients using these carriers.  The next window will let you select which carrier to keep when combining."), ""
                                , MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }
            int[] pickedCarrierNums = new int[gridMain.SelectedIndices.Length];
            if (checkCDAnet.Checked)
            {
                for (int i = 0; i < pickedCarrierNums.Length; i++)
                {
                    pickedCarrierNums[i] = PIn.PInt(table.Rows[gridMain.SelectedIndices[i]]["CarrierNum"].ToString());
                }
            }
            else
            {
                for (int i = 0; i < pickedCarrierNums.Length; i++)
                {
                    pickedCarrierNums[i] = Carriers.List[gridMain.SelectedIndices[i]].CarrierNum;
                }
            }
            FormCarrierCombine FormCB = new FormCarrierCombine();

            FormCB.CarrierNums = pickedCarrierNums;
            FormCB.ShowDialog();
            if (FormCB.DialogResult != DialogResult.OK)
            {
                return;
            }
            changed = true;
            //int[] combCarrierNums=new int[tbCarriers.SelectedIndices.Length];
            //for(int i=0;i<tbCarriers.SelectedIndices.Length;i++){
            //	carrierNums[i]=Carriers.List[tbCarriers.SelectedIndices[i]].CarrierNum;
            //}
            try{
                Carriers.Combine(pickedCarrierNums, FormCB.PickedCarrierNum);
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FillGrid();
        }