Ejemplo n.º 1
0
 ///<summary>Inserts one DisplayField into the database.  Returns the new priKey.</summary>
 internal static long Insert(DisplayField displayField)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         displayField.DisplayFieldNum=DbHelper.GetNextOracleKey("displayfield","DisplayFieldNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(displayField,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     displayField.DisplayFieldNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(displayField,false);
     }
 }
Ejemplo n.º 2
0
 ///<summary>Inserts one DisplayField into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(DisplayField displayField,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         displayField.DisplayFieldNum=ReplicationServers.GetKey("displayfield","DisplayFieldNum");
     }
     string command="INSERT INTO displayfield (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="DisplayFieldNum,";
     }
     command+="InternalName,ItemOrder,Description,ColumnWidth,Category,ChartViewNum) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(displayField.DisplayFieldNum)+",";
     }
     command+=
          "'"+POut.String(displayField.InternalName)+"',"
         +    POut.Int   (displayField.ItemOrder)+","
         +"'"+POut.String(displayField.Description)+"',"
         +    POut.Int   (displayField.ColumnWidth)+","
         +    POut.Int   ((int)displayField.Category)+","
         +    POut.Long  (displayField.ChartViewNum)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         displayField.DisplayFieldNum=Db.NonQ(command,true);
     }
     return displayField.DisplayFieldNum;
 }
Ejemplo n.º 3
0
        /// <param name="catalog">The name of the database on which queries are being executed to.</param>
        public static IEnumerable<DisplayField> GetDisplayFields(string catalog)
        {
            List<DisplayField> displayFields = new List<DisplayField>();

            const string sql = "SELECT employee_type_id AS key, employee_type_code || ' (' || employee_type_name || ')' as value FROM hrm.employee_types;";
            using (NpgsqlCommand command = new NpgsqlCommand(sql))
            {
                using (DataTable table = DbOperation.GetDataTable(catalog, command))
                {
                    if (table?.Rows == null || table.Rows.Count == 0)
                    {
                        return displayFields;
                    }

                    foreach (DataRow row in table.Rows)
                    {
                        if (row != null)
                        {
                            DisplayField displayField = new DisplayField
                            {
                                Key = row["key"].ToString(),
                                Value = row["value"].ToString()
                            };

                            displayFields.Add(displayField);
                        }
                    }
                }
            }

            return displayFields;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Displayfields provide a minimal name/value context for data binding the row collection of office.cash_repository_selector_view.
        /// </summary>
        /// <returns>Returns an enumerable name and value collection for the view office.cash_repository_selector_view</returns>
        /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
        public IEnumerable <DisplayField> GetDisplayFields()
        {
            List <DisplayField> displayFields = new List <DisplayField>();

            if (string.IsNullOrWhiteSpace(this._Catalog))
            {
                return(displayFields);
            }

            if (!this.SkipValidation)
            {
                if (!this.Validated)
                {
                    this.Validate(AccessTypeEnum.Read, this._LoginId, this._Catalog, false);
                }
                if (!this.HasAccess)
                {
                    Log.Information("Access to get display field for entity \"CashRepositorySelectorView\" was denied to the user with Login ID {LoginId}", this._LoginId);
                    throw new UnauthorizedException("Access is denied.");
                }
            }

            const string sql = "SELECT cash_repository_id AS key, cash_repository_code || ' (' || cash_repository_name || ')' as value FROM office.cash_repository_selector_view;";

            using (NpgsqlCommand command = new NpgsqlCommand(sql))
            {
                using (DataTable table = DbOperation.GetDataTable(this._Catalog, command))
                {
                    if (table?.Rows == null || table.Rows.Count == 0)
                    {
                        return(displayFields);
                    }

                    foreach (DataRow row in table.Rows)
                    {
                        if (row != null)
                        {
                            DisplayField displayField = new DisplayField
                            {
                                Key   = row["key"].ToString(),
                                Value = row["value"].ToString()
                            };

                            displayFields.Add(displayField);
                        }
                    }
                }
            }

            return(displayFields);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Displayfields provide a minimal name/value context for data binding the row collection of config.access_types.
        /// </summary>
        /// <returns>Returns an enumerable name and value collection for the table config.access_types</returns>
        /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
        public IEnumerable <Frapid.DataAccess.Models.DisplayField> GetDisplayFields()
        {
            List <Frapid.DataAccess.Models.DisplayField> displayFields = new List <Frapid.DataAccess.Models.DisplayField>();

            if (string.IsNullOrWhiteSpace(this._Catalog))
            {
                return(displayFields);
            }

            if (!this.SkipValidation)
            {
                if (!this.Validated)
                {
                    this.Validate(AccessTypeEnum.Read, this._LoginId, this._Catalog, false);
                }
                if (!this.HasAccess)
                {
                    Log.Information("Access to get display field for entity \"AccessType\" was denied to the user with Login ID {LoginId}", this._LoginId);
                    throw new UnauthorizedException("Access is denied.");
                }
            }

            const string sql = "SELECT access_type_id AS key, access_type_name as value FROM config.access_types;";

            using (NpgsqlCommand command = new NpgsqlCommand(sql))
            {
                using (DataTable table = DbOperation.GetDataTable(this._Catalog, command))
                {
                    if (table?.Rows == null || table.Rows.Count == 0)
                    {
                        return(displayFields);
                    }

                    foreach (DataRow row in table.Rows)
                    {
                        if (row != null)
                        {
                            DisplayField displayField = new DisplayField
                            {
                                Key   = row["key"].ToString(),
                                Value = row["value"].ToString()
                            };

                            displayFields.Add(displayField);
                        }
                    }
                }
            }

            return(displayFields);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Displayfields provide a minimal name/value context for data binding the row collection of transactions.party_sales_chart_view.
        /// </summary>
        /// <returns>Returns an enumerable name and value collection for the view transactions.party_sales_chart_view</returns>
        /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
        public IEnumerable <DisplayField> GetDisplayFields()
        {
            List <DisplayField> displayFields = new List <DisplayField>();

            if (string.IsNullOrWhiteSpace(this._Catalog))
            {
                return(displayFields);
            }

            if (!this.SkipValidation)
            {
                if (!this.Validated)
                {
                    this.Validate(AccessTypeEnum.Read, this._LoginId, this._Catalog, false);
                }
                if (!this.HasAccess)
                {
                    Log.Information("Access to get display field for entity \"PartySalesChartView\" was denied to the user with Login ID {LoginId}", this._LoginId);
                    throw new UnauthorizedException("Access is denied.");
                }
            }

            const string sql = "SELECT transaction_master_id AS key, row_number as value FROM transactions.party_sales_chart_view;";

            using (NpgsqlCommand command = new NpgsqlCommand(sql))
            {
                using (DataTable table = DbOperation.GetDataTable(this._Catalog, command))
                {
                    if (table?.Rows == null || table.Rows.Count == 0)
                    {
                        return(displayFields);
                    }

                    foreach (DataRow row in table.Rows)
                    {
                        if (row != null)
                        {
                            DisplayField displayField = new DisplayField
                            {
                                Key   = row["key"].ToString(),
                                Value = row["value"].ToString()
                            };

                            displayFields.Add(displayField);
                        }
                    }
                }
            }

            return(displayFields);
        }
Ejemplo n.º 7
0
        private DisplayField __BuildControl__control17()
        {
            DisplayField field = new DisplayField();

            field.ApplyStyleSheetSkin(this);
            field.ColSpan = 1;
            object[] parameters = new object[5];
            parameters[0] = field;
            parameters[2] = 0x5b3;
            parameters[3] = 0x40;
            parameters[4] = false;
            this.__PageInspector_SetTraceData(parameters);
            return(field);
        }
Ejemplo n.º 8
0
 ///<summary>Inserts one DisplayField into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(DisplayField displayField)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(displayField, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             displayField.DisplayFieldNum = DbHelper.GetNextOracleKey("displayfield", "DisplayFieldNum");                  //Cacheless method
         }
         return(InsertNoCache(displayField, true));
     }
 }
Ejemplo n.º 9
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            DisplayField df = (DisplayField)gridMain.Rows[e.Row].Tag;
            FormDisplayFieldOrthoEdit form = new FormDisplayFieldOrthoEdit();

            form.ListAllFields = GetAllFields();
            form.FieldCur      = df;
            form.ShowDialog();
            if (form.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillGrids();
            changed = true;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Tries to Format the Aggregate Field
        /// </summary>
        /// <param name="displayField">The <see cref="DisplayField"/> to be formatted</param>
        /// <param name="formattedDisplayField">Reference to the string where the formmatted <see cref="DisplayField"/> will be stored</param>
        /// <returns>A <see cref="bool">Boolean</see> value to define whether the formatting succeeded or failed</returns>
        public bool TryFormatField(DisplayField displayField, out string formattedDisplayField)
        {
            // Initialize Return String
            formattedDisplayField = "";

            try
            {
                formattedDisplayField = FormatField(displayField);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>A hash code for the current object.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = 17;
         result = result * 23 + ((Condition != null) ? Condition.GetHashCode() : 0);
         result = result * 23 + ((Code != null) ? Code.GetHashCode() : 0);
         result = result * 23 + ((NameField != null) ? NameField.GetHashCode() : 0);
         result = result * 23 + ((DisplayField != null) ? DisplayField.GetHashCode() : 0);
         result = result * 23 + ((AdditionalFilterSql != null) ? AdditionalFilterSql.GetHashCode() : 0);
         result = result * 23 + ((AdditionalFilterDesc != null) ? AdditionalFilterDesc.GetHashCode() : 0);
         result = result * 23 + AdditionalFilterDesc.GetHashCode();
         return(result);
     }
 }
Ejemplo n.º 12
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            DisplayField         tempField = ListShowing[e.Row].Copy();
            FormDisplayFieldEdit formD     = new FormDisplayFieldEdit();

            formD.FieldCur = ListShowing[e.Row];
            formD.ShowDialog();
            if (formD.DialogResult != DialogResult.OK)
            {
                ListShowing[e.Row] = tempField.Copy();
                return;
            }
            FillGrids();
            changed = true;
        }
Ejemplo n.º 13
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<DisplayField> TableToList(DataTable table){
			List<DisplayField> retVal=new List<DisplayField>();
			DisplayField displayField;
			for(int i=0;i<table.Rows.Count;i++) {
				displayField=new DisplayField();
				displayField.DisplayFieldNum= PIn.Long  (table.Rows[i]["DisplayFieldNum"].ToString());
				displayField.InternalName   = PIn.String(table.Rows[i]["InternalName"].ToString());
				displayField.ItemOrder      = PIn.Int   (table.Rows[i]["ItemOrder"].ToString());
				displayField.Description    = PIn.String(table.Rows[i]["Description"].ToString());
				displayField.ColumnWidth    = PIn.Int   (table.Rows[i]["ColumnWidth"].ToString());
				displayField.Category       = (OpenDentBusiness.DisplayFieldCategory)PIn.Int(table.Rows[i]["Category"].ToString());
				displayField.ChartViewNum   = PIn.Long  (table.Rows[i]["ChartViewNum"].ToString());
				retVal.Add(displayField);
			}
			return retVal;
		}
Ejemplo n.º 14
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            FormDisplayFieldEdit formD = new FormDisplayFieldEdit();

            formD.FieldCur = ListShowing[e.Row];
            DisplayField tempField = ListShowing[e.Row].Copy();

            formD.ShowDialog();
            if (formD.DialogResult != DialogResult.OK)
            {
                ListShowing[e.Row] = tempField.Copy();
                return;
            }
            if (category == DisplayFieldCategory.OrthoChart)
            {
                if (ListShowing[e.Row].Description == "")
                {
                    ListShowing[e.Row] = tempField.Copy();
                    MsgBox.Show(this, "Description cannot be blank.");
                    return;
                }
                for (int i = 0; i < ListShowing.Count; i++)           //Check against ListShowing only
                {
                    if (i == e.Row)
                    {
                        continue;
                    }
                    if (ListShowing[e.Row].Description == ListShowing[i].Description)
                    {
                        ListShowing[e.Row] = tempField;
                        MsgBox.Show(this, "That field name already exists.");
                        return;
                    }
                }
                for (int i = 0; i < AvailList.Count; i++)           //check against AvailList only
                {
                    if (ListShowing[e.Row].Description == AvailList[i].Description)
                    {
                        ListShowing[e.Row] = tempField;
                        MsgBox.Show(this, "That field name already exists.");
                        return;
                    }
                }
            }
            FillGrids();
            changed = true;
        }
    public TranslatedPasswordComponentSolver(TwitchModule module) :
        base(module)
    {
        _downButtons  = (KMSelectable[])DownButtonField.GetValue(module.BombComponent.GetComponent(PasswordComponentType));
        _submitButton = (MonoBehaviour)SubmitButtonField.GetValue(module.BombComponent.GetComponent(PasswordComponentType));
        _display      = (TextMesh[])DisplayField.GetValue(module.BombComponent.GetComponent(PasswordComponentType));
        ModInfo       = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} cycle 1 3 5 [cycle through the letters in columns 1, 3, and 5] | !{0} cycle [cycle through all columns] | !{0} toggle [move all columns down one letter] | !{0} world [try to submit a word]").Clone();

        string language = TranslatedModuleHelper.GetManualCodeAddOn(module.BombComponent.GetComponent(PasswordComponentType), PasswordComponentType);

        if (language != null)
        {
            ManualCode = $"Password{language}";
        }
        ModInfo.moduleDisplayName = $"Passwords Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(module.BombComponent.GetComponent(PasswordComponentType), PasswordComponentType)}";
        Module.HeaderText         = ModInfo.moduleDisplayName;
    }
    private void OnActivate()
    {
        string   serial   = Module.Bomb.QueryWidgets <string>(KMBombInfo.QUERYKEY_GET_SERIAL_NUMBER).First()["serial"];
        TextMesh textMesh = (TextMesh)DisplayField.GetValue(Module.BombComponent.GetComponent(ComponentType));

        ActivatedField.SetValue(Module.BombComponent.GetComponent(ComponentType), true);

        if (string.IsNullOrEmpty(_previousSerialNumber) || !_previousSerialNumber.Equals(serial) || _keyTurnTimes.Count == 0)
        {
            if (!string.IsNullOrEmpty(_previousSerialNumber) && _previousSerialNumber.Equals(serial))
            {
                Animator keyAnimator = (Animator)KeyAnimatorField.GetValue(Module.BombComponent.GetComponent(ComponentType));
                KMAudio  keyAudio    = (KMAudio)KeyAudioField.GetValue(Module.BombComponent.GetComponent(ComponentType));
                AttemptedForcedSolve = true;
                PrepareSilentSolve();
                Module.BombComponent.GetComponent <KMBombModule>().HandlePass();
                KeyUnlockedField.SetValue(Module.BombComponent.GetComponent(ComponentType), true);
                SolvedField.SetValue(Module.BombComponent.GetComponent(ComponentType), true);
                keyAnimator.SetBool("IsUnlocked", true);
                keyAudio.PlaySoundAtTransform("TurnTheKeyFX", Module.transform);
                textMesh.text = "88:88";
                return;
            }

            _keyTurnTimes.Clear();
            for (int i = OtherModes.Unexplodable ? 45 : 3; i < (OtherModes.Unexplodable ? 3600 : Module.Bomb.CurrentTimer - 45); i += 3)
            {
                _keyTurnTimes.Add(i);
            }
            if (_keyTurnTimes.Count == 0)
            {
                _keyTurnTimes.Add((int)(Module.Bomb.CurrentTimer / 2f));
            }

            _keyTurnTimes         = _keyTurnTimes.Shuffle().ToList();
            _previousSerialNumber = serial;
        }
        TargetTimeField.SetValue(Module.BombComponent.GetComponent(ComponentType), _keyTurnTimes[0]);

        string display = $"{_keyTurnTimes[0] / 60:00}:{_keyTurnTimes[0] % 60:00}";

        _keyTurnTimes.RemoveAt(0);

        textMesh.text = display;
    }
        private void FillGrids()
        {
            labelCategory.Text = _listOrthoChartTabs[0].TabName;          //Placed here so that Up/Down buttons will affect the label text.
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col;

            col = new GridColumn(Lan.g("FormDisplayFields", "Description"), 200);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("FormDisplayFields", "Width"), 80);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            OrthoChartTabFields      orthoChartTabFields = GetSelectedFields();
            List <OrthoChartTabLink> listLinks           = _listOrthoChartTabLinks.FindAll(x => x.OrthoChartTabNum == orthoChartTabFields.OrthoChartTab.OrthoChartTabNum);

            _listAvailableFields = GetAllFields();
            for (int i = 0; i < orthoChartTabFields.ListDisplayFields.Count; i++)
            {
                DisplayField df = orthoChartTabFields.ListDisplayFields[i];
                _listAvailableFields.Remove(df);
                GridRow row = new GridRow();
                row.Tag = df;
                string description = df.Description;
                if (!string.IsNullOrEmpty(df.DescriptionOverride))
                {
                    description += " (" + df.DescriptionOverride + ")";
                }
                row.Cells.Add(description);
                int columnWidth        = df.ColumnWidth;
                OrthoChartTabLink link = listLinks.FirstOrDefault(x => x.DisplayFieldNum == df.DisplayFieldNum);
                if (link != null && link.ColumnWidthOverride > 0)
                {
                    columnWidth = link.ColumnWidthOverride;
                }
                row.Cells.Add(POut.Int(columnWidth));
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
            listAvailable.Items.Clear();
            for (int i = 0; i < _listAvailableFields.Count; i++)
            {
                listAvailable.Items.Add(_listAvailableFields[i].Description);
            }
        }
Ejemplo n.º 18
0
        ///<summary>Inserts one DisplayField into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(DisplayField displayField, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO displayfield (";

            if (!useExistingPK && isRandomKeys)
            {
                displayField.DisplayFieldNum = ReplicationServers.GetKeyNoCache("displayfield", "DisplayFieldNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "DisplayFieldNum,";
            }
            command += "InternalName,ItemOrder,Description,ColumnWidth,Category,ChartViewNum,PickList,DescriptionOverride) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(displayField.DisplayFieldNum) + ",";
            }
            command +=
                "'" + POut.String(displayField.InternalName) + "',"
                + POut.Int(displayField.ItemOrder) + ","
                + "'" + POut.String(displayField.Description) + "',"
                + POut.Int(displayField.ColumnWidth) + ","
                + POut.Int((int)displayField.Category) + ","
                + POut.Long(displayField.ChartViewNum) + ","
                + DbHelper.ParamChar + "paramPickList,"
                + "'" + POut.String(displayField.DescriptionOverride) + "')";
            if (displayField.PickList == null)
            {
                displayField.PickList = "";
            }
            OdSqlParameter paramPickList = new OdSqlParameter("paramPickList", OdDbType.Text, POut.StringParam(displayField.PickList));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramPickList);
            }
            else
            {
                displayField.DisplayFieldNum = Db.NonQ(command, true, "DisplayFieldNum", "displayField", paramPickList);
            }
            return(displayField.DisplayFieldNum);
        }
Ejemplo n.º 19
0
        private void __BuildControl__control16(ItemsCollection <AbstractComponent> __ctrl)
        {
            TextField field = this.__BuildControltxtUsername();

            __ctrl.Add(field);
            TextField field2 = this.__BuildControltxtPassword();

            __ctrl.Add(field2);
            TextField field3 = this.__BuildControltxtVerifyCode();

            __ctrl.Add(field3);
            Ext.Net.Image image = this.__BuildControlimgVerify();
            __ctrl.Add(image);
            DisplayField field4 = this.__BuildControl__control17();

            __ctrl.Add(field4);
            Ext.Net.LinkButton button = this.__BuildControlbtnChangeImage();
            __ctrl.Add(button);
        }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textWidth.errorProvider1.GetError(textWidth) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            if (textInternalName.Text.Trim() == "")
            {
                MsgBox.Show(this, "Internal Name cannot be blank.");
                return;
            }
            //Verify that the user did not change the field name to the same name as another field.
            DisplayField displayFieldOther = _listAllFields.FirstOrDefault(x => x != _fieldCur && x.Description == _fieldCur.Description);

            if (displayFieldOther != null)
            {
                MsgBox.Show(this, "An ortho chart field with that Internal Name already exists.");
                return;
            }
            _fieldCur.Description         = textInternalName.Text;
            _fieldCur.DescriptionOverride = textDisplayName.Text;
            int colWidth = PIn.Int(textWidth.Text);

            if (_isOverrideMode)             //Editing ColumnWidthOverride,
            {
                _tabLinkCur.ColumnWidthOverride = (colWidth == _fieldCur.ColumnWidth?0:colWidth);
            }
            else                                                 //Editing the default ColumnWidth of the DisplayField.
            {
                _fieldCur.ColumnWidth = PIn.Int(textWidth.Text); //Use FieldCur
            }
            _fieldCur.PickList = textPickList.Text;
            if (checkSignature.Checked)
            {
                _fieldCur.InternalName = "Signature";
            }
            else
            {
                _fieldCur.InternalName = "";
            }
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 21
0
        public static void Refresh()
        {
            string    command = "SELECT * FROM displayfield ORDER BY ItemOrder";
            DataTable table   = General.GetTable(command);

            Listt = new List <DisplayField>();
            DisplayField field;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                field = new DisplayField();
                field.DisplayFieldNum = PIn.PInt(table.Rows[i][0].ToString());
                field.InternalName    = PIn.PString(table.Rows[i][1].ToString());
                field.ItemOrder       = PIn.PInt(table.Rows[i][2].ToString());
                field.Description     = PIn.PString(table.Rows[i][3].ToString());
                field.ColumnWidth     = PIn.PInt(table.Rows[i][4].ToString());
                Listt.Add(field);
            }
        }
Ejemplo n.º 22
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <DisplayField> TableToList(DataTable table)
        {
            List <DisplayField> retVal = new List <DisplayField>();
            DisplayField        displayField;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                displayField = new DisplayField();
                displayField.DisplayFieldNum = PIn.Long(table.Rows[i]["DisplayFieldNum"].ToString());
                displayField.InternalName    = PIn.String(table.Rows[i]["InternalName"].ToString());
                displayField.ItemOrder       = PIn.Int(table.Rows[i]["ItemOrder"].ToString());
                displayField.Description     = PIn.String(table.Rows[i]["Description"].ToString());
                displayField.ColumnWidth     = PIn.Int(table.Rows[i]["ColumnWidth"].ToString());
                displayField.Category        = (DisplayFieldCategory)PIn.Int(table.Rows[i]["Category"].ToString());
                displayField.ChartViewNum    = PIn.Long(table.Rows[i]["ChartViewNum"].ToString());
                retVal.Add(displayField);
            }
            return(retVal);
        }
Ejemplo n.º 23
0
            /*! \brief Return the objects of the gadgets that make up the %StringSet.
             * \param [out] alphaNumeric An object that wraps the DisplayField part of the %StringSet.
             * \param [out] popupMenu An object that wraps the PopupMenu part of the %StringSet.
             * \return Nothing.
             * \exception ArgumentException Thrown if the alphaNumeric part is a WritableField rather
             * than a DisplayField.
             * \note There is an alternative method to use when the alphaNumeric part is a WritableField.  */
            public void GetComponents(out DisplayField alphaNumeric,
                                      out PopupMenu popupMenu)
            {
                uint alphaNumericID;
                uint popupMenuID;

                Object.MiscOp_SetR3GetR0R1(3,                  // Return both component IDs
                                           Method.GetComponents,
                                           ComponentID,
                                           out alphaNumericID,
                                           out popupMenuID);

                if (GetType(Object.ID, alphaNumericID) != ComponentType.DisplayField)
                {
                    throw new ArgumentException("alphaNumeric", "Component is not a DisplayField");
                }

                alphaNumeric = new DisplayField((Window)Object, alphaNumericID);
                popupMenu    = new PopupMenu((Window)Object, popupMenuID);
            }
            public GraphInstanceMetaContainer(string guid)
            {
                if (guid != null)
                {
                    GUID      = guid;
                    Path      = AssetDatabase.GUIDToAssetPath(guid);
                    ObjectRef = AssetDatabase.LoadAssetAtPath <NodeGraph>(Path);
                    Name      = ObjectRef ? ObjectRef.name : "";
                    IsValid   = ObjectRef != null;

                    if (!IsValid)
                    {
                        GUID      = "";
                        Path      = "";
                        ObjectRef = null;
                        Name      = "";
                    }
                }
                DisplayField.SetObject(ObjectRef);
            }
Ejemplo n.º 25
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <DisplayField> TableToList(DataTable table)
        {
            List <DisplayField> retVal = new List <DisplayField>();
            DisplayField        displayField;

            foreach (DataRow row in table.Rows)
            {
                displayField = new DisplayField();
                displayField.DisplayFieldNum     = PIn.Long(row["DisplayFieldNum"].ToString());
                displayField.InternalName        = PIn.String(row["InternalName"].ToString());
                displayField.ItemOrder           = PIn.Int(row["ItemOrder"].ToString());
                displayField.Description         = PIn.String(row["Description"].ToString());
                displayField.ColumnWidth         = PIn.Int(row["ColumnWidth"].ToString());
                displayField.Category            = (OpenDentBusiness.DisplayFieldCategory)PIn.Int(row["Category"].ToString());
                displayField.ChartViewNum        = PIn.Long(row["ChartViewNum"].ToString());
                displayField.PickList            = PIn.String(row["PickList"].ToString());
                displayField.DescriptionOverride = PIn.String(row["DescriptionOverride"].ToString());
                retVal.Add(displayField);
            }
            return(retVal);
        }
Ejemplo n.º 26
0
        ///<summary>Updates one DisplayField in the database.</summary>
        public static void Update(DisplayField displayField)
        {
            string command = "UPDATE displayfield SET "
                             + "InternalName       = '" + POut.String(displayField.InternalName) + "', "
                             + "ItemOrder          =  " + POut.Int(displayField.ItemOrder) + ", "
                             + "Description        = '" + POut.String(displayField.Description) + "', "
                             + "ColumnWidth        =  " + POut.Int(displayField.ColumnWidth) + ", "
                             + "Category           =  " + POut.Int((int)displayField.Category) + ", "
                             + "ChartViewNum       =  " + POut.Long(displayField.ChartViewNum) + ", "
                             + "PickList           =  " + DbHelper.ParamChar + "paramPickList, "
                             + "DescriptionOverride= '" + POut.String(displayField.DescriptionOverride) + "' "
                             + "WHERE DisplayFieldNum = " + POut.Long(displayField.DisplayFieldNum);

            if (displayField.PickList == null)
            {
                displayField.PickList = "";
            }
            OdSqlParameter paramPickList = new OdSqlParameter("paramPickList", OdDbType.Text, POut.StringParam(displayField.PickList));

            Db.NonQ(command, paramPickList);
        }
Ejemplo n.º 27
0
        public IEnumerable <UIElement> GetFieldInfo(IModelObject modelObject)
        {
            var fields = GetAllFields(modelObject);

            var article = modelObject as Article;

            if (ShowId && article != null)
            {
                yield return(new PropertyDisplay {
                    Title = "Id", Value = article.Id
                });
            }
            foreach (var field in fields.OfType <ArticleField>())
            {
                if (field is IGetFieldStringValue)
                {
                    var control = new DisplayField()
                    {
                        Value = field as PlainArticleField,
                        HideEmptyPlainFields = HideEmptyFields || HideEmptyPlainFields
                    };

                    yield return(control);
                }
                else if (field is IGetArticle)
                {
                    yield return(new ArticleInfo((IGetArticle)field,
                                                 hideEmptyFields: HideEmptyFields || HideEmptyArticleFields,
                                                 showIcon: ShowIcons));
                }
                else if (field is IGetArticles)
                {
                    yield return(new ArticleCollection(modelObject, (IGetArticles)field,
                                                       hideEmptyMultipleFields: HideEmptyFields || HideEmptyMultipleFields,
                                                       showIcon: ShowIcons,
                                                       isHorizontal: ShowCollectionsHorizontal,
                                                       separator: CollectionSeparator));
                }
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Formats the field to a valid string appendable to a query
        /// </summary>
        /// <param name="displayField">The <see cref="DisplayField"/> to be formatted</param>
        /// <returns>A <see cref="string"/> with the formatted field.</returns>
        public virtual string FormatField(DisplayField displayField)
        {
            // Checks if the field is valid
            ValidateField(displayField);

            // Return the formatted display field
            StringBuilder sb = new StringBuilder();

            // Append Field Name Itself
            sb.Append(FormatFieldAfterValidation((Field)displayField));

            // Append Alternate Name at the End
            if (displayField.AlternateName != null)
            {
                if (displayField.AlternateName != "")
                {
                    sb.Append($" {displayField.AlternateName}");
                }
            }

            // Return the formatted DisplayField
            return(sb.ToString());
        }
Ejemplo n.º 29
0
        private void FillGrids()
        {
            labelCategory.Text = _listOrthoChartTabs[0].TabName;          //Placed here so that Up/Down buttons will affect the label text.
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g("FormDisplayFields", "Description"), 200);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("FormDisplayFields", "Width"), 80);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            OrthoChartTabFields orthoChartTabFields = GetSelectedFields();

            _listAvailableFields = GetAllFields();
            for (int i = 0; i < orthoChartTabFields.ListDisplayFields.Count; i++)
            {
                DisplayField df = orthoChartTabFields.ListDisplayFields[i];
                _listAvailableFields.Remove(df);
                ODGridRow row = new ODGridRow();
                row.Tag = df;
                string description = df.Description;
                if (!string.IsNullOrEmpty(df.DescriptionOverride))
                {
                    description += " (" + df.DescriptionOverride + ")";
                }
                row.Cells.Add(description);
                row.Cells.Add(df.ColumnWidth.ToString());
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            listAvailable.Items.Clear();
            for (int i = 0; i < _listAvailableFields.Count; i++)
            {
                listAvailable.Items.Add(_listAvailableFields[i].Description);
            }
        }
Ejemplo n.º 30
0
 ///<summary>Returns true if Update(DisplayField,DisplayField) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(DisplayField displayField, DisplayField oldDisplayField)
 {
     if (displayField.InternalName != oldDisplayField.InternalName)
     {
         return(true);
     }
     if (displayField.ItemOrder != oldDisplayField.ItemOrder)
     {
         return(true);
     }
     if (displayField.Description != oldDisplayField.Description)
     {
         return(true);
     }
     if (displayField.ColumnWidth != oldDisplayField.ColumnWidth)
     {
         return(true);
     }
     if (displayField.Category != oldDisplayField.Category)
     {
         return(true);
     }
     if (displayField.ChartViewNum != oldDisplayField.ChartViewNum)
     {
         return(true);
     }
     if (displayField.PickList != oldDisplayField.PickList)
     {
         return(true);
     }
     if (displayField.DescriptionOverride != oldDisplayField.DescriptionOverride)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 31
0
 private bool IsDisplayable(FieldLookups lookups, DisplayField displayField)
 {
     return(AreSet(lookups, displayField.RequiredField));
 }
Ejemplo n.º 32
0
		///<summary>Updates one DisplayField in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
		public static bool Update(DisplayField displayField,DisplayField oldDisplayField){
			string command="";
			if(displayField.InternalName != oldDisplayField.InternalName) {
				if(command!=""){ command+=",";}
				command+="InternalName = '"+POut.String(displayField.InternalName)+"'";
			}
			if(displayField.ItemOrder != oldDisplayField.ItemOrder) {
				if(command!=""){ command+=",";}
				command+="ItemOrder = "+POut.Int(displayField.ItemOrder)+"";
			}
			if(displayField.Description != oldDisplayField.Description) {
				if(command!=""){ command+=",";}
				command+="Description = '"+POut.String(displayField.Description)+"'";
			}
			if(displayField.ColumnWidth != oldDisplayField.ColumnWidth) {
				if(command!=""){ command+=",";}
				command+="ColumnWidth = "+POut.Int(displayField.ColumnWidth)+"";
			}
			if(displayField.Category != oldDisplayField.Category) {
				if(command!=""){ command+=",";}
				command+="Category = "+POut.Int   ((int)displayField.Category)+"";
			}
			if(displayField.ChartViewNum != oldDisplayField.ChartViewNum) {
				if(command!=""){ command+=",";}
				command+="ChartViewNum = "+POut.Long(displayField.ChartViewNum)+"";
			}
			if(command==""){
				return false;
			}
			command="UPDATE displayfield SET "+command
				+" WHERE DisplayFieldNum = "+POut.Long(displayField.DisplayFieldNum);
			Db.NonQ(command);
			return true;
		}
Ejemplo n.º 33
0
		///<summary>Updates one DisplayField in the database.</summary>
		public static void Update(DisplayField displayField){
			string command="UPDATE displayfield SET "
				+"InternalName   = '"+POut.String(displayField.InternalName)+"', "
				+"ItemOrder      =  "+POut.Int   (displayField.ItemOrder)+", "
				+"Description    = '"+POut.String(displayField.Description)+"', "
				+"ColumnWidth    =  "+POut.Int   (displayField.ColumnWidth)+", "
				+"Category       =  "+POut.Int   ((int)displayField.Category)+", "
				+"ChartViewNum   =  "+POut.Long  (displayField.ChartViewNum)+" "
				+"WHERE DisplayFieldNum = "+POut.Long(displayField.DisplayFieldNum);
			Db.NonQ(command);
		}
 public MurderComponentSolver(TwitchModule module) :
     base(module, "MurderModule", "Cycle the options with !{0} cycle or !{0} cycle people (also weapons and rooms). Make an accusation with !{0} It was Peacock, with the candlestick, in the kitchen. Or you can set the options individually, and accuse with !{0} accuse.")
 {
     _buttons = (KMSelectable[])ButtonsField.GetValue(_component);
     _display = (TextMesh[])DisplayField.GetValue(_component);
 }
Ejemplo n.º 35
0
 private void butLeft_Click(object sender, EventArgs e)
 {
     if (category == DisplayFieldCategory.OrthoChart)           //Ortho Chart
     {
         if (listAvailable.SelectedItems.Count == 0 && textCustomField.Text == "")
         {
             MsgBox.Show(this, "Please select an item in the list on the right or create a new field first.");
             return;
         }
         if (textCustomField.Text != "")               //Add new ortho chart field
         {
             for (int i = 0; i < ListShowing.Count; i++)
             {
                 if (textCustomField.Text == ListShowing[i].Description)
                 {
                     MsgBox.Show(this, "That field is already displaying.");
                     return;
                 }
             }
             for (int i = 0; i < AvailList.Count; i++)
             {
                 if (textCustomField.Text == AvailList[i].Description)
                 {
                     ListShowing.Add(AvailList[i]);
                     textCustomField.Text = "";
                     changed = true;
                     FillGrids();
                     return;
                 }
             }
             DisplayField df = new DisplayField("", 100, DisplayFieldCategory.OrthoChart);
             df.Description = textCustomField.Text;
             ListShowing.Add(df);
             textCustomField.Text = "";
         }
         else                  //add existing ortho chart field(s)
         {
             DisplayField field;
             for (int i = 0; i < listAvailable.SelectedItems.Count; i++)
             {
                 field             = AvailList[listAvailable.SelectedIndices[i]];
                 field.ColumnWidth = 100;
                 ListShowing.Add(field);
             }
         }
     }
     else              //All other display field types
     {
         if (listAvailable.SelectedItems.Count == 0)
         {
             MsgBox.Show(this, "Please select an item in the list on the right first.");
             return;
         }
         DisplayField field;
         for (int i = 0; i < listAvailable.SelectedItems.Count; i++)
         {
             field = (DisplayField)listAvailable.SelectedItems[i];
             ListShowing.Add(field);
         }
     }
     changed = true;
     FillGrids();
 }
        /// <summary>
        /// Parses the existing fields.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <returns>IEnumerable{DisplayField}.</returns>
        private static IEnumerable<DisplayField> ParseExistingFields(XElement doc)
        {
            var result = new List<DisplayField>();

            foreach (var element in doc.Elements("ExistingRecordsFields").Elements())
            {
                var displayField =
                    new DisplayField(
                        element.With(e => e.Attribute("FieldName")).Return(a => a.Value, string.Empty),
                        element.With(e => e.Attribute("FullPath")).Return(a => a.Value, string.Empty),
                        SafeTypeConverter.Convert<double>(element.With(e => e.Attribute("Order")).Return(a => a.Value, "0")),
                        SafeTypeConverter.Convert<bool>(element.With(e => e.Attribute("IsBuiltIn")).Return(a => a.Value, "false"))
                    );

                result.Add(displayField);
            }

            return result;
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Displayfields provide a minimal name/value context for data binding the row collection of hrm.leave_applications.
        /// </summary>
        /// <returns>Returns an enumerable name and value collection for the table hrm.leave_applications</returns>
        /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception>
        public IEnumerable<DisplayField> GetDisplayFields()
        {
            List<DisplayField> displayFields = new List<DisplayField>();

            if (string.IsNullOrWhiteSpace(this._Catalog))
            {
                return displayFields;
            }

            if (!this.SkipValidation)
            {
                if (!this.Validated)
                {
                    this.Validate(AccessTypeEnum.Read, this._LoginId, false);
                }
                if (!this.HasAccess)
                {
                    Log.Information("Access to get display field for entity \"LeaveApplication\" was denied to the user with Login ID {LoginId}", this._LoginId);
                    throw new UnauthorizedException("Access is denied.");
                }
            }

            const string sql = "SELECT leave_application_id AS key, leave_application_id as value FROM hrm.leave_applications;";
            using (NpgsqlCommand command = new NpgsqlCommand(sql))
            {
                using (DataTable table = DbOperation.GetDataTable(this._Catalog, command))
                {
                    if (table?.Rows == null || table.Rows.Count == 0)
                    {
                        return displayFields;
                    }

                    foreach (DataRow row in table.Rows)
                    {
                        if (row != null)
                        {
                            DisplayField displayField = new DisplayField
                            {
                                Key = row["key"].ToString(),
                                Value = row["value"].ToString()
                            };

                            displayFields.Add(displayField);
                        }
                    }
                }
            }

            return displayFields;
        }
Ejemplo n.º 38
0
        private void butOK_Click(object sender, EventArgs e)
        {
            OrthoChartTabFields orphanedTab = _listTabDisplayFields.Find(x => x.OrthoChartTab == null);

            //No need to do anything if nothing changed and there are no 'orphaned' display fields to delete.
            if (!changed && (orphanedTab != null && orphanedTab.ListDisplayFields.All(x => x.DisplayFieldNum == 0)))
            {
                DialogResult = DialogResult.OK;
                return;
            }
            //Get all fields associated to a tab in order to sync with the database later.
            List <DisplayField> listAllFields = GetAllFields(false);

            if (listAllFields.Count(x => x.InternalName == "Signature") > 1)
            {
                MessageBox.Show(Lan.g(this, "Only one display field can be a signature field.  Fields that have the signature field checkbox checked:") + " "
                                + string.Join(", ", listAllFields.FindAll(x => x.InternalName == "Signature").Select(x => x.Description)));
                return;
            }
            //Ensure all new displayfields have a primary key so that tab links can be created below.  Update existing displayfields.
            foreach (DisplayField df in listAllFields)
            {
                if (df.DisplayFieldNum == 0)               //New displayfield
                {
                    DisplayFields.Insert(df);
                }
                else                  //Existing displayfield.
                {
                    DisplayFields.Update(df);
                }
            }
            DataValid.SetInvalid(InvalidType.DisplayFields);
            //Remove tab links which no longer exist.  Update tab link item order for tab links which still belong to the same tab.
            List <OrthoChartTabLink> listOrthoChartTabLinks = OrthoChartTabLinks.GetDeepCopy();

            for (int i = listOrthoChartTabLinks.Count - 1; i >= 0; i--)
            {
                OrthoChartTabLink   orthoChartTabLink   = listOrthoChartTabLinks[i];
                OrthoChartTabFields orthoChartTabFields = _listTabDisplayFields.FirstOrDefault(
                    x => x.OrthoChartTab != null && x.OrthoChartTab.OrthoChartTabNum == orthoChartTabLink.OrthoChartTabNum);
                if (orthoChartTabFields == null)
                {
                    continue;                    //The tab was hidden and we are going to leave the tab links alone.
                }
                DisplayField df = orthoChartTabFields.ListDisplayFields.FirstOrDefault(x => x.DisplayFieldNum == orthoChartTabLink.DisplayFieldNum);
                if (df == null)               //The tab link no longer exists (was removed).
                {
                    listOrthoChartTabLinks.RemoveAt(i);
                }
                else                  //The tab link still exists.  Update the link with any changes.
                {
                    orthoChartTabLink.ItemOrder = orthoChartTabFields.ListDisplayFields.IndexOf(df);
                }
            }
            //Add new tab links which were just created.
            foreach (OrthoChartTabFields orthoChartTabFields in _listTabDisplayFields)
            {
                //Skip "orphaned" fields that just show in the available fields list.
                if (orthoChartTabFields.OrthoChartTab == null)
                {
                    continue;
                }
                foreach (DisplayField df in orthoChartTabFields.ListDisplayFields)
                {
                    OrthoChartTabLink orthoChartTabLink = listOrthoChartTabLinks.FirstOrDefault(
                        x => x.OrthoChartTabNum == orthoChartTabFields.OrthoChartTab.OrthoChartTabNum && x.DisplayFieldNum == df.DisplayFieldNum);
                    if (orthoChartTabLink != null)
                    {
                        continue;
                    }
                    orthoChartTabLink                  = new OrthoChartTabLink();
                    orthoChartTabLink.ItemOrder        = orthoChartTabFields.ListDisplayFields.IndexOf(df);
                    orthoChartTabLink.OrthoChartTabNum = orthoChartTabFields.OrthoChartTab.OrthoChartTabNum;
                    orthoChartTabLink.DisplayFieldNum  = df.DisplayFieldNum;
                    listOrthoChartTabLinks.Add(orthoChartTabLink);
                }
            }
            //Delete any display fields that have a valid PK and are in the "orphaned" list.
            //This is fine to do because the field will show back up in the available list of display fields if a patient is still using the field.
            //This is because we link the ortho chart display fields by their name instead of by their PK.
            if (orphanedTab != null)           //An orphaned list actually exists.
            //Look for any display fields that have a valid PK (this means the user removed this field from every tab and we need to delete it).
            {
                List <DisplayField> listFieldsToDelete = orphanedTab.ListDisplayFields.FindAll(x => x.DisplayFieldNum != 0);
                listFieldsToDelete.ForEach(x => DisplayFields.Delete(x.DisplayFieldNum));
            }
            OrthoChartTabLinks.Sync(listOrthoChartTabLinks, OrthoChartTabLinks.GetDeepCopy());
            DataValid.SetInvalid(InvalidType.OrthoChartTabs);
            DialogResult = DialogResult.OK;
        }