コード例 #1
0
        public static bool GridDefsDoubleClick(Def selectedDef, ODGrid gridDefs, DefCatOptions selectedDefCatOpt, List <Def> listDefsCur, List <Def> listDefsAll, bool isDefChanged)
        {
            switch (selectedDefCatOpt.DefCat)
            {
            case DefCat.BlockoutTypes:
                FormDefEditBlockout FormDEB = new FormDefEditBlockout(selectedDef);
                FormDEB.ShowDialog();
                if (FormDEB.DialogResult == DialogResult.OK)
                {
                    isDefChanged = true;
                }
                break;

            case DefCat.ImageCats:
                FormDefEditImages FormDEI = new FormDefEditImages(selectedDef);
                FormDEI.IsNew = false;
                FormDEI.ShowDialog();
                if (FormDEI.DialogResult == DialogResult.OK)
                {
                    isDefChanged = true;
                }
                break;

            case DefCat.WebSchedNewPatApptTypes:
                FormDefEditWSNPApptTypes FormDEWSNPAT = new FormDefEditWSNPApptTypes(selectedDef);
                if (FormDEWSNPAT.ShowDialog() == DialogResult.OK)
                {
                    if (FormDEWSNPAT.IsDeleted)
                    {
                        listDefsAll.Remove(selectedDef);
                    }
                    isDefChanged = true;
                }
                break;

            default:                    //Show the normal FormDefEdit window.
                FormDefEdit FormDefEdit2 = new FormDefEdit(selectedDef, listDefsCur, selectedDefCatOpt);
                FormDefEdit2.IsNew = false;
                FormDefEdit2.ShowDialog();
                if (FormDefEdit2.DialogResult == DialogResult.OK)
                {
                    if (FormDefEdit2.IsDeleted)
                    {
                        listDefsAll.Remove(selectedDef);
                    }
                    isDefChanged = true;
                }
                break;
            }
            return(isDefChanged);
        }
コード例 #2
0
        public static bool AddDef(ODGrid gridDefs, DefCatOptions selectedDefCatOpt)
        {
            Def defCur = new Def();

            defCur.IsNew = true;
            int itemOrder = 0;

            if (Defs.GetDefsForCategory(selectedDefCatOpt.DefCat).Count > 0)
            {
                itemOrder = Defs.GetDefsForCategory(selectedDefCatOpt.DefCat).Max(x => x.ItemOrder) + 1;
            }
            defCur.ItemOrder = itemOrder;
            defCur.Category  = selectedDefCatOpt.DefCat;
            defCur.ItemName  = "";
            defCur.ItemValue = "";          //necessary
            if (selectedDefCatOpt.DefCat == DefCat.InsurancePaymentType)
            {
                defCur.ItemValue = "N";
            }
            switch (selectedDefCatOpt.DefCat)
            {
            case DefCat.BlockoutTypes:
                FormDefEditBlockout FormDEB = new FormDefEditBlockout(defCur);
                FormDEB.IsNew = true;
                if (FormDEB.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }
                break;

            case DefCat.ImageCats:
                FormDefEditImages FormDEI = new FormDefEditImages(defCur);
                FormDEI.IsNew = true;
                FormDEI.ShowDialog();
                if (FormDEI.DialogResult != DialogResult.OK)
                {
                    return(false);
                }
                break;

            case DefCat.WebSchedNewPatApptTypes:
                FormDefEditWSNPApptTypes FormDEWSNPAT = new FormDefEditWSNPApptTypes(defCur);
                if (FormDEWSNPAT.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }
                break;

            default:
                List <Def> listCurrentDefs = new List <Def>();
                foreach (ODGridRow rowCur in gridDefs.Rows)
                {
                    listCurrentDefs.Add((Def)rowCur.Tag);
                }
                FormDefEdit FormDE = new FormDefEdit(defCur, listCurrentDefs, selectedDefCatOpt);
                FormDE.IsNew = true;
                FormDE.ShowDialog();
                if (FormDE.DialogResult != DialogResult.OK)
                {
                    return(false);
                }
                break;
            }
            return(true);
        }