示例#1
0
        ///<summary></summary>
        private void FillGridCustom()
        {
            ClaimFormItems.RefreshCache();
            ClaimForms.RefreshCache();
            comboReassign.Items.Clear();
            gridCustom.BeginUpdate();
            gridCustom.Columns.Clear();
            gridCustom.Columns.Add(new ODGridColumn(Lan.g("TableClaimFormsCustom", "ClaimForm"), 145));
            gridCustom.Columns.Add(new ODGridColumn(Lan.g("TableClaimFormsCustom", "Default"), 50, HorizontalAlignment.Center));
            gridCustom.Columns.Add(new ODGridColumn(Lan.g("TableClaimFormsCustom", "Hidden"), 0, HorizontalAlignment.Center));
            gridCustom.Rows.Clear();
            string description;

            foreach (ClaimForm claimFormCur in ClaimForms.GetDeepCopy())
            {
                description = claimFormCur.Description;
                ODGridRow row = new ODGridRow();
                row.Cells.Add(claimFormCur.Description);
                if (claimFormCur.ClaimFormNum == PrefC.GetLong(PrefName.DefaultClaimForm))
                {
                    description += " " + Lan.g(this, "(default)");
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                if (claimFormCur.IsHidden)
                {
                    description += " " + Lan.g(this, "(hidden)");
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Tag = claimFormCur;
                gridCustom.Rows.Add(row);
                comboReassign.Items.Add(new ODBoxItem <ClaimForm>(description, claimFormCur));
            }
            gridCustom.EndUpdate();
        }
示例#2
0
        ///<summary></summary>
        private void FillList()
        {
            ClaimForms.RefreshCache();
            listClaimForms.Items.Clear();
            comboReassign.Items.Clear();
            string description;

            for (int i = 0; i < ClaimForms.ListLong.Length; i++)
            {
                description = ClaimForms.ListLong[i].Description;
                if (ClaimForms.ListLong[i].IsHidden)
                {
                    description += " (hidden)";
                }
                if (ClaimForms.ListLong[i].ClaimFormNum == PrefC.GetLong(PrefName.DefaultClaimForm))
                {
                    description += " (default)";
                }
                listClaimForms.Items.Add(description);
                comboReassign.Items.Add(description);
            }
        }
示例#3
0
        ///<summary>Can be called externally as part of the conversion sequence.  Surround with try catch.  Always returns the ClaimFormNum of the claimform.  If using xmlData, path will be ignored, so leave it blank.</summary>
        public static long ImportForm(string path, bool isUpdateSequence, string xmlData)
        {
            ClaimForm     tempClaimForm = new ClaimForm();
            XmlSerializer serializer    = new XmlSerializer(typeof(ClaimForm));

            if (xmlData == "")          //use path
            {
                if (!File.Exists(path))
                {
                    throw new ApplicationException(Lan.g("FormClaimForm", "File does not exist."));
                }
                try {
                    using (TextReader reader = new StreamReader(path)) {
                        tempClaimForm = (ClaimForm)serializer.Deserialize(reader);
                    }
                }
                catch {
                    throw new ApplicationException(Lan.g("FormClaimForm", "Invalid file format"));
                }
            }
            else             //use xmlData
            {
                try {
                    using (TextReader reader = new StringReader(xmlData)) {
                        tempClaimForm = (ClaimForm)serializer.Deserialize(reader);
                    }
                }
                catch {
                    throw new ApplicationException(Lan.g("FormClaimForm", "Invalid file format"));
                }
            }
            long retVal = 0;
            bool isNew  = true;

            if (isUpdateSequence)
            {
                ClaimFormItems.RefreshCache();
                ClaimForms.RefreshCache();
            }
            if (tempClaimForm.UniqueID != "")          //if it's blank, it's always inserted.
            {
                for (int i = 0; i < ClaimForms.ListLong.Length; i++)
                {
                    if (ClaimForms.ListLong[i].UniqueID == tempClaimForm.UniqueID)
                    {
                        isNew  = false;
                        retVal = ClaimForms.ListLong[i].ClaimFormNum;
                    }
                }
            }
            if (isNew)
            {
                ClaimForms.Insert(tempClaimForm);                //now we have a primary key.
                retVal = tempClaimForm.ClaimFormNum;
                for (int j = 0; j < tempClaimForm.Items.Length; j++)
                {
                    tempClaimForm.Items[j].ClaimFormNum = tempClaimForm.ClaimFormNum;                  //so even though the ClaimFormNum is wrong, this line fixes it.
                    ClaimFormItems.Insert(tempClaimForm.Items[j]);
                }
            }
            else
            {
                if (!isUpdateSequence)
                {
                    if (MessageBox.Show(tempClaimForm.Description + " already exists.  Replace?", "",
                                        MessageBoxButtons.OKCancel) != DialogResult.OK)
                    {
                        return(0);
                    }
                }
                ClaimForms.UpdateByUniqueID(tempClaimForm);
            }
            return(retVal);
        }