Esempio n. 1
0
        private void FormDefEdit_Load(object sender, System.EventArgs e)
        {
            if (DefCur.Category == DefCat.ApptConfirmed)
            {
                _listExcludeSendNums    = PrefC.GetString(PrefName.ApptConfirmExcludeESend).Split(',').ToList().Select(x => PIn.Long(x)).ToList();
                _listExcludeConfirmNums = PrefC.GetString(PrefName.ApptConfirmExcludeEConfirm).Split(',').ToList().Select(x => PIn.Long(x)).ToList();
                _listExcludeRemindNums  = PrefC.GetString(PrefName.ApptConfirmExcludeERemind).Split(',').ToList().Select(x => PIn.Long(x)).ToList();
                //0 will get automatically added to the list when this is the first of its kind.  We never want 0 inserted.
                _listExcludeSendNums.Remove(0);
                _listExcludeConfirmNums.Remove(0);
                _listExcludeRemindNums.Remove(0);
                checkExcludeSend.Checked    = _listExcludeSendNums.Contains(DefCur.DefNum);
                checkExcludeConfirm.Checked = _listExcludeConfirmNums.Contains(DefCur.DefNum);
                checkExcludeRemind.Checked  = _listExcludeRemindNums.Contains(DefCur.DefNum);
            }
            else
            {
                groupEConfirm.Visible      = false;
                groupBoxEReminders.Visible = false;
            }
            if (DefCur.DefNum.In(PrefC.GetLong(PrefName.AppointmentTimeArrivedTrigger), PrefC.GetLong(PrefName.AppointmentTimeDismissedTrigger),
                                 PrefC.GetLong(PrefName.AppointmentTimeSeatedTrigger)))
            {
                //We never want to send confirmation or reminders to an appointment when it is in a triggered confirm status.
                checkExcludeConfirm.Enabled = false;
                checkExcludeRemind.Enabled  = false;
                checkExcludeSend.Enabled    = false;
                checkExcludeConfirm.Checked = true;
                checkExcludeRemind.Checked  = true;
                checkExcludeSend.Checked    = true;
            }
            string itemName = DefCur.ItemName;

            _selectedValueString = DefCur.ItemValue;
            if (!_defCatOptions.CanEditName)
            {
                //Allow foreign users to translate definitions that they do not have access to translate.
                //Use FormDefinitions instead of 'this' because the users will have already translated the item names in that form and no need to duplicate.
                itemName          = Lan.g("FormDefinitions", DefCur.ItemName);
                textName.ReadOnly = true;
                if (!DefCur.IsHidden || Defs.IsDefDeprecated(DefCur))
                {
                    checkHidden.Enabled = false;                  //prevent hiding defs that are hard-coded into OD. Prevent unhiding defs that are deprecated.
                }
            }
            labelValue.Text = _defCatOptions.ValueText;
            if (DefCur.Category == DefCat.AdjTypes && !IsNew)
            {
                labelValue.Text   = "Not allowed to change type after an adjustment is created.";
                textValue.Visible = false;
            }
            if (!_defCatOptions.EnableValue)
            {
                labelValue.Visible = false;
                textValue.Visible  = false;
            }
            if (!_defCatOptions.EnableColor)
            {
                labelColor.Visible = false;
                butColor.Visible   = false;
            }
            if (!_defCatOptions.CanHide)
            {
                checkHidden.Visible = false;
            }
            if (!_defCatOptions.CanDelete)
            {
                butDelete.Visible = false;
            }
            if (_defCatOptions.IsValueDefNum)
            {
                textValue.ReadOnly  = true;
                textValue.BackColor = SystemColors.Control;
                labelValue.Text     = Lan.g("FormDefinitions", "Use the select button to choose a definition from the list.");
                long defNumCur = PIn.Long(DefCur.ItemValue ?? "");
                if (defNumCur > 0)
                {
                    textValue.Text = _defsList.FirstOrDefault(x => defNumCur == x.DefNum)?.ItemName ?? "";
                }
                butSelect.Visible     = true;
                butClearValue.Visible = true;
            }
            else if (_defCatOptions.DoShowItemOrderInValue)
            {
                labelValue.Text       = Lan.g(this, "Internal Priority");
                textValue.Text        = DefCur.ItemOrder.ToString();
                textValue.ReadOnly    = true;
                butSelect.Visible     = false;
                butClearValue.Visible = false;
            }
            else
            {
                textValue.Text        = DefCur.ItemValue;
                butSelect.Visible     = false;
                butClearValue.Visible = false;
            }
            textName.Text       = itemName;
            butColor.BackColor  = DefCur.ItemColor;
            checkHidden.Checked = DefCur.IsHidden;
        }
Esempio n. 2
0
        ///<summary>Fills the passed in grid with the definitions in the passed in list.</summary>
        public static void FillGridDefs(ODGrid gridDefs, DefCatOptions selectedDefCatOpt, List <Def> listDefsCur)
        {
            Def selectedDef = null;

            if (gridDefs.GetSelectedIndex() > -1)
            {
                selectedDef = (Def)gridDefs.Rows[gridDefs.GetSelectedIndex()].Tag;
            }
            int scroll = gridDefs.ScrollValue;

            gridDefs.BeginUpdate();
            gridDefs.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g("TableDefs", "Name"), 190);
            gridDefs.Columns.Add(col);
            col = new ODGridColumn(selectedDefCatOpt.ValueText, 190);
            gridDefs.Columns.Add(col);
            col = new ODGridColumn(selectedDefCatOpt.EnableColor ? Lan.g("TableDefs", "Color") : "", 40);
            gridDefs.Columns.Add(col);
            col = new ODGridColumn(selectedDefCatOpt.CanHide ? Lan.g("TableDefs", "Hide") : "", 30, HorizontalAlignment.Center);
            gridDefs.Columns.Add(col);
            gridDefs.Rows.Clear();
            ODGridRow row;

            foreach (Def defCur in listDefsCur)
            {
                if (!PrefC.IsODHQ && defCur.ItemValue == CommItemTypeAuto.ODHQ.ToString())
                {
                    continue;
                }
                if (Defs.IsDefDeprecated(defCur))
                {
                    defCur.IsHidden = true;
                }
                row = new ODGridRow();
                if (selectedDefCatOpt.CanEditName)
                {
                    row.Cells.Add(defCur.ItemName);
                }
                else                                                          //Users cannot edit the item name so let them translate them.
                {
                    row.Cells.Add(Lan.g("FormDefinitions", defCur.ItemName)); //Doesn't use 'this' so that renaming the form doesn't change the translation
                }
                if (selectedDefCatOpt.DefCat == DefCat.ImageCats)
                {
                    row.Cells.Add(GetItemDescForImages(defCur.ItemValue));
                }
                else if (selectedDefCatOpt.DefCat == DefCat.AutoNoteCats)
                {
                    Dictionary <string, string> dictAutoNoteDefs = new Dictionary <string, string>();
                    dictAutoNoteDefs = listDefsCur.ToDictionary(x => x.DefNum.ToString(), x => x.ItemName);
                    string nameCur;
                    row.Cells.Add(dictAutoNoteDefs.TryGetValue(defCur.ItemValue, out nameCur) ? nameCur : defCur.ItemValue);
                }
                else if (selectedDefCatOpt.DefCat == DefCat.WebSchedNewPatApptTypes)
                {
                    AppointmentType appointmentType = AppointmentTypes.GetWebSchedNewPatApptTypeByDef(defCur.DefNum);
                    row.Cells.Add(appointmentType == null ? "" : appointmentType.AppointmentTypeName);
                }
                else if (selectedDefCatOpt.DoShowItemOrderInValue)
                {
                    row.Cells.Add(defCur.ItemOrder.ToString());
                }
                else
                {
                    row.Cells.Add(defCur.ItemValue);
                }
                row.Cells.Add("");
                if (selectedDefCatOpt.EnableColor)
                {
                    row.Cells[row.Cells.Count - 1].CellColor = defCur.ItemColor;
                }
                if (defCur.IsHidden)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Tag = defCur;
                gridDefs.Rows.Add(row);
            }
            gridDefs.EndUpdate();
            if (selectedDef != null)
            {
                for (int i = 0; i < gridDefs.Rows.Count; i++)
                {
                    if (((Def)gridDefs.Rows[i].Tag).DefNum == selectedDef.DefNum)
                    {
                        gridDefs.SetSelected(i, true);
                        break;
                    }
                }
            }
            gridDefs.ScrollValue = scroll;
        }