Example #1
0
        private void FillListBoxAdjTypes()
        {
            List <Def> adjCat = Defs.GetCatList((int)DefCat.AdjTypes).ToList();

            //Positive adjustment types
            _listAdjPosCats = adjCat.FindAll(x => x.ItemValue == "+");
            _listAdjPosCats.ForEach(x => listTypePos.Items.Add(x.ItemName));
            //Negativate adjustment types
            _listAdjNegCats = adjCat.FindAll(x => x.ItemValue == "-");
            _listAdjNegCats.ForEach(x => listTypeNeg.Items.Add(x.ItemName));
        }
Example #2
0
        private void FillDefs()
        {
            //Defs.IsSelected=false;
            int scroll = tbDefs.ScrollValue;

            DefsList = Defs.GetCatList(SelectedCat);
            tbDefs.ResetRows(DefsList.Length);
            tbDefs.SetBackGColor(Color.White);
            for (int i = 0; i < DefsList.Length; i++)
            {
                tbDefs.Cell[0, i] = DefsList[i].ItemName;
                tbDefs.Cell[1, i] = DefsList[i].ItemValue;
                if (FormDefEdit.EnableColor)
                {
                    tbDefs.BackGColor[2, i] = DefsList[i].ItemColor;
                }
                if (DefsList[i].IsHidden)
                {
                    tbDefs.Cell[3, i] = "X";
                }
                //else tbDefs.Cell[3,i]="";
            }
            if (DefsIsSelected)
            {
                tbDefs.BackGColor[0, DefsSelected] = Color.LightGray;
                tbDefs.BackGColor[1, DefsSelected] = Color.LightGray;
            }
            tbDefs.Fields[1] = FormDefEdit.ValueText;
            if (FormDefEdit.EnableColor)
            {
                tbDefs.Fields[2] = "Color";
            }
            else
            {
                tbDefs.Fields[2] = "";
            }
            tbDefs.LayoutTables();
            tbDefs.ScrollValue = scroll;
            //the following do not require a refresh of the table:
            if (FormDefEdit.CanEditName)
            {
                groupEdit.Enabled = true;
                groupEdit.Text    = "Edit Items";
            }
            else
            {
                groupEdit.Enabled = false;
                groupEdit.Text    = "Not allowed";
            }
            textGuide.Text = FormDefEdit.HelpText;
        }
        ///<summary>Saves all images in the grid to the patient on the claim's directory in the images module. Also creates
        ///a list of ClaimAttach objects to associate to the given claim.</summary>
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //The user must create an image or narrative attachment before sending.
            if (gridAttachedImages.ListGridRows.Count == 0 && textNarrative.Text.Trim().Length == 0)
            {
                MsgBox.Show(this, "An image or narrative must be specified before continuing.");
                return;
            }
            try {
                CreateAndSendAttachments();
            }
            //Creating and sending Attachments will sometimes time out when an arbirtrarily large group of attachments are being sent,
            //at which point each attachment should be sent individually.
            catch (TimeoutException ex) {
                ex.DoNothing();
                ODProgress.ShowAction(() => { BatchSendAttachments(); }, "Sending attachments timed out. Attempting to send individually. Please wait.");
            }
            catch (ODException ex) {
                //ODExceptions should already be Lans.g when throwing meaningful messages.
                //If they weren't translated, the message was from a third party and shouldn't be translated anyway.
                MessageBox.Show(ex.Message);
                return;
            }
            //Validate the claim, if it isn't valid let the user decide if they want to continue
            if (!ValidateClaimHelper())
            {
                if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "There were errors validating the claim, would you like to continue?"))
                {
                    return;
                }
            }
            //Used for determining which category to save the image attachments to. 0 will save the image to the first category in the Images module.
            long imageTypeDefNum   = 0;
            Def  defClaimAttachCat = CheckImageCatDefs().FirstOrDefault();

            if (defClaimAttachCat != null)
            {
                imageTypeDefNum = defClaimAttachCat.DefNum;
            }
            else              //User does not have a Claim Attachment image category, just use the first image category available.
            {
                imageTypeDefNum = Defs.GetCatList((int)DefCat.ImageCats).FirstOrDefault(x => !x.IsHidden).DefNum;
            }
            List <ClaimAttach> listClaimAttachments = new List <ClaimAttach>();

            for (int i = 0; i < gridAttachedImages.ListGridRows.Count; i++)
            {
                ClaimConnect.ImageAttachment imageRow = ((ClaimConnect.ImageAttachment)gridAttachedImages.ListGridRows[i].Tag);
                if (PrefC.GetBool(PrefName.SaveDXCAttachments))
                {
                    Bitmap   imageBitmap = new Bitmap(imageRow.Image);
                    Document docCur      = ImageStore.Import(imageBitmap, imageTypeDefNum, ImageType.Document, _claimPat);
                    imageRow.ImageFileNameActual = docCur.FileName;
                }
                //Create attachment objects
                listClaimAttachments.Add(CreateClaimAttachment(imageRow.ImageFileNameDisplay, imageRow.ImageFileNameActual));
            }
            //Keep a running list of attachments sent to DXC for the claim. This will show in the attachments listbox.
            _claimCur.Attachments.AddRange(listClaimAttachments);
            Claims.Update(_claimCur);
            MsgBox.Show("Attachments sent successfully!");
            DialogResult = DialogResult.OK;
        }
 ///<summary>Checks to see if the user has made a Claim Attachment image category definition. Returns the list of Defs found.</summary>
 private List <Def> CheckImageCatDefs()
 {
     //Filter down to image categories that have been marked as Claim Attachment.
     return(Defs.GetCatList((int)DefCat.ImageCats).ToList().FindAll(x => x.ItemValue.Contains("C") && !x.IsHidden));
 }