Example #1
0
        private IntPtr addAFieldToView(GMCustomField gmField)
        {
            IntPtr fieldContainer;

            fieldContainer = NativeMethods.GMW_NV_Create();

            NativeMethods.GMW_NV_SetValue(fieldContainer, "Action", "new");

            NativeMethods.GMW_NV_SetValue(fieldContainer, "VerticalCenter", "28");
            NativeMethods.GMW_NV_SetValue(fieldContainer, "HorizontalCenter", gmField.FieldRow);
            NativeMethods.GMW_NV_SetValue(fieldContainer, "LabelSize", "30");
            NativeMethods.GMW_NV_SetValue(fieldContainer, "EditWidth", "50");

            if (!string.IsNullOrEmpty(gmField.FieldName))
                NativeMethods.GMW_NV_SetValue(fieldContainer, "FieldName", gmField.FieldName);

            if (!string.IsNullOrEmpty(gmField.FieldLabel))
            {
                NativeMethods.GMW_NV_SetValue(fieldContainer, "GlobalLabel", gmField.FieldLabel);
                NativeMethods.GMW_NV_SetValue(fieldContainer, "LocalLabel", gmField.FieldLabel);
            }

            return fieldContainer;
        }
Example #2
0
        private void editAField(string strAction, GMCustomField gmField)
        {
            String ErrMsg = "Successful";
            IntPtr fieldsContainer;

            fieldsContainer = NativeMethods.GMW_NV_Create();

            if (!string.IsNullOrEmpty(strAction))
                NativeMethods.GMW_NV_SetValue(fieldsContainer, "Action", strAction);

            if (!string.IsNullOrEmpty(gmField.FieldLabel))
                NativeMethods.GMW_NV_SetValue(fieldsContainer, "Description", gmField.FieldLabel);

            if (!string.IsNullOrEmpty(gmField.FieldName))
                NativeMethods.GMW_NV_SetValue(fieldsContainer, "Name", gmField.FieldName);

            if (!string.IsNullOrEmpty(gmField.FieldType))
                NativeMethods.GMW_NV_SetValue(fieldsContainer, "Type", gmField.FieldType);

            //if (!string.IsNullOrEmpty(strNewName))
            //    NativeMethods.GMW_NV_SetValue(fieldsContainer, "NewName", strNewName);

            if (!string.IsNullOrEmpty(gmField.FieldLen))
                NativeMethods.GMW_NV_SetValue(fieldsContainer, "Length", gmField.FieldLen);

            //if (!string.IsNullOrEmpty(strDec))
            //    NativeMethods.GMW_NV_SetValue(fieldsContainer, "Decimals", strDec);

            // Exec the EDITCUSTOMFIELD function
            x = NativeMethods.GMW_Execute("EDITCUSTOMFIELD", fieldsContainer);

            if (x == 0)
                ErrMsg = "General Failure";
            else if (x == -1)
                ErrMsg = "Not a master rights user";
            else if (x == -2)
                ErrMsg = "Cannot open ContUDef";
            else if (x == -3)
                ErrMsg = "Invalid action";
            else if (x == -4)
                ErrMsg = "Invalid field name";
            else if (x == -5)
                ErrMsg = "Name is not unique";
            else if (x == -6)
                ErrMsg = "Field not found";
            else if (x == -7)
                ErrMsg = "Field not allowed to be deleted";
            else if (x == -8)
                ErrMsg = "Invalid field type";
            else if (x == -9)
                ErrMsg = "Missing field parameters";
            else if (x == -10)
                ErrMsg = "Failure deleting field";
            else if (x == -11)
                ErrMsg = "Cannot write record";
            ULogging.writeToDebugLog(AppGlobal.getAppLogger(), "editAField: " + ErrMsg);

            NativeMethods.GMW_NV_Delete(fieldsContainer);
        }
Example #3
0
 private void updateFieldView(string strViewId, GMCustomField gmField)
 {
     string query = "update FIELDS5 set fcol=' 28', LABELSIZE=30, EDITSIZE=50, frow=' " + gmField.FieldRow + "' where RECTYPE='F' and ViewId='" + strViewId + "' and FldName='" + gmField.FieldName + "'";
     execQuerry(query, "updateFieldView: ");
 }
Example #4
0
 private void aGMField(GMCustomField gmField)
 {
     editAField("delete", gmField);
     if (x == 1 || x == -6)
         editAField("New", gmField);
 }