Exemple #1
0
        public ActionResult SysVarDelete(string deleteId)
        {
            string  username = BackEndSessions.CurrentUser.UserName;
            SysVars sysVars  = new SysVars();

            switch (sysVars.Delete(deleteId, username))
            {
            case 0:
                ModelState.AddResult(ViewData, ModelStateResult.Success, Resources.Strings.ItemSuccessfullyDeleted);
                break;

            case 2:
                ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ItemDoesNotExist);
                break;

            case 3:
                ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ItemUsedSomewhereElse);
                break;

            default:
                ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.UnexpectedError);
                break;
            }
            return(RedirectToAction("SysVars"));
        }
Exemple #2
0
        public ActionResult SysVarAddEdit(BackEndSysVarAddEdit sysVarAddEdit)
        {
            string  username   = BackEndSessions.CurrentUser.UserName;
            SysVars categories = new SysVars();
            string  currentId  = sysVarAddEdit.Sys_Id;

            if (ModelState.IsValidOrRefresh())
            {
                var rs = categories.AddEdit(
                    currentId,
                    sysVarAddEdit.Sys_Var,
                    sysVarAddEdit.Sys_Type,
                    sysVarAddEdit.Sys_Value,
                    sysVarAddEdit.Sys_Name,
                    sysVarAddEdit.IsEditable,
                    username
                    );
                switch (rs)
                {
                case 0:
                    ModelState.AddResult(ViewData, ModelStateResult.Success, Resources.Strings.ItemSuccessfullyAddEdit);
                    break;

                case 2:
                    ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ItemDoesNotExist);
                    break;

                default:
                    ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.UnexpectedError);
                    break;
                }
            }
            return(View(sysVarAddEdit));
        }
Exemple #3
0
        public ActionResult SysVars(BackEndSysVarList backEndSysVarList)
        {
            SysVars sysVars = new SysVars();

            backEndSysVarList.SysVars = sysVars.GetAll();
            if (backEndSysVarList.SysVars.IsNull() || backEndSysVarList.SysVars.Count == 0)
            {
                ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.NoDataFound);
            }
            return(View(backEndSysVarList));
        }
Exemple #4
0
        public ActionResult SysVarAddEdit(string id)
        {
            BackEndSysVarAddEdit sysVarAddEdit = new BackEndSysVarAddEdit();

            if (id.IsNotNull())
            {
                SysVars sysVars = new SysVars();
                var     sysVar  = sysVars.FilterById(id);
                if (sysVar.IsNotNull())
                {
                    sysVarAddEdit.Sys_Id     = sysVar.Sys_Id;
                    sysVarAddEdit.Sys_Var    = sysVar.Sys_Var;
                    sysVarAddEdit.Sys_Type   = sysVar.Sys_Type;
                    sysVarAddEdit.Sys_Value  = sysVar.Sys_Value;
                    sysVarAddEdit.Sys_Name   = sysVar.Sys_Name;
                    sysVarAddEdit.IsEditable = sysVar.IsEditable;
                }
            }
            return(View(sysVarAddEdit));
        }
Exemple #5
0
        private void InternListSection(ref int rlngIdx)
        {
            SysVars dobjSysVars2 = new SysVars();
            Dictionary <object, object> dobjDictPos2 = new Dictionary <object, object>();
            IEnumerator enumerator = default(IEnumerator);
            int         dlngMaxPos = default(int);

            try
            {
                enumerator = dobjSysVars2.GetValues().GetEnumerator();
                while (enumerator.MoveNext())
                {
                    SysVar dobjSysVar2 = (SysVar)enumerator.Current;
                    SysVar sysVar      = dobjSysVar2;
                    if (dobjSysVar2.HeaderPos != null)
                    {
                        int dlngPos = Conversions.ToInteger(sysVar.HeaderPos);
                        if (dlngMaxPos < dlngPos)
                        {
                            dlngMaxPos = dlngPos;
                        }
                        dobjDictPos2.Add(dlngPos, sysVar.Name);
                    }
                    sysVar = null;
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
            int num = dlngMaxPos;

            checked
            {
                string               dstrName        = default(string);
                bool                 dblnSummaryInfo = default(bool);
                IEnumerator          enumerator2     = default(IEnumerator);
                AcadSummaryInfoField dobjAcadSummaryInfoField;
                AcadSummaryInfo      dobjAcadSummaryInfo;
                AcadSysVar           dobjAcadSysVar;
                for (int dlngIndex = 1; dlngIndex <= num; dlngIndex++)
                {
                    bool dblnValid = false;
                    try
                    {
                        dstrName  = Conversions.ToString(dobjDictPos2[dlngIndex]);
                        dblnValid = true;
                    }
                    catch (Exception ex2)
                    {
                        ProjectData.SetProjectError(ex2);
                        Exception ex = ex2;
                        ProjectData.ClearProjectError();
                    }
                    if (!dblnValid || Operators.CompareString(dstrName, null, TextCompare: false) == 0)
                    {
                        continue;
                    }
                    dobjAcadSysVar = mobjAcadDocument.FriendFindVariable(dstrName);
                    if (dobjAcadSysVar != null)
                    {
                        AcadSysVar acadSysVar     = dobjAcadSysVar;
                        object     dvarValue2     = RuntimeHelpers.GetObjectValue(acadSysVar.Value);
                        object     dvarArraySize  = RuntimeHelpers.GetObjectValue(acadSysVar.ArraySize);
                        object     dvarHeaderCode = RuntimeHelpers.GetObjectValue(acadSysVar.HeaderCode);
                        acadSysVar = null;
                        if (dvarValue2 != null)
                        {
                            if (Operators.CompareString(dstrName, "DIMDSEP", TextCompare: false) != 0)
                            {
                                if (Operators.CompareString(dstrName, "CECOLOR", TextCompare: false) == 0)
                                {
                                    dvarValue2 = hwpDxf_Functions.BkDXF_ColorStringToLong(Conversions.ToString(dvarValue2));
                                }
                            }
                            else
                            {
                                Type     typeFromHandle = typeof(Strings);
                                object[] obj            = new object[1]
                                {
                                    dvarValue2
                                };
                                object[] array = obj;
                                bool[]   obj2  = new bool[1]
                                {
                                    true
                                };
                                bool[] array2 = obj2;
                                object obj3   = NewLateBinding.LateGet(null, typeFromHandle, "Asc", obj, null, null, obj2);
                                if (array2[0])
                                {
                                    dvarValue2 = RuntimeHelpers.GetObjectValue(array[0]);
                                }
                                dvarValue2 = RuntimeHelpers.GetObjectValue(obj3);
                            }
                            InternAddToDictLine(ref rlngIdx, 9, "$" + dstrName);
                            if (dvarArraySize != null)
                            {
                                int num2 = Conversions.ToInteger(Operators.SubtractObject(dvarArraySize, 1));
                                for (int dlngArrayIdx = 0; dlngArrayIdx <= num2; dlngArrayIdx++)
                                {
                                    InternAddToDictLine(ref rlngIdx, Conversions.ToInteger(NewLateBinding.LateIndexGet(dvarHeaderCode, new object[1]
                                    {
                                        dlngArrayIdx
                                    }, null)), RuntimeHelpers.GetObjectValue(NewLateBinding.LateIndexGet(dvarValue2, new object[1]
                                    {
                                        dlngArrayIdx
                                    }, null)));
                                }
                            }
                            else
                            {
                                InternAddToDictLine(ref rlngIdx, Conversions.ToInteger(dvarHeaderCode), RuntimeHelpers.GetObjectValue(dvarValue2));
                            }
                        }
                        else
                        {
                            hwpDxf_Functions.BkDXF_DebugPrint("Header Systemvariablen Wert ist Null: " + dstrName);
                        }
                    }
                    if (Operators.CompareString(mstrAcadVer, "AC1018", TextCompare: false) >= 0 && !dblnSummaryInfo && Operators.CompareString(Strings.UCase(dstrName), Strings.UCase("DWGCODEPAGE"), TextCompare: false) == 0)
                    {
                        dblnSummaryInfo     = true;
                        dobjAcadSummaryInfo = mobjAcadDocument.SummaryInfo;
                        AcadSummaryInfo acadSummaryInfo = dobjAcadSummaryInfo;
                        if (Operators.CompareString(acadSummaryInfo.Title, null, TextCompare: false) != 0)
                        {
                            InternAddToDictLine(ref rlngIdx, 9, "$TITLE");
                            InternAddToDictLine(ref rlngIdx, 1, acadSummaryInfo.Title);
                        }
                        if (Operators.CompareString(acadSummaryInfo.Subject, null, TextCompare: false) != 0)
                        {
                            InternAddToDictLine(ref rlngIdx, 9, "$SUBJECT");
                            InternAddToDictLine(ref rlngIdx, 1, acadSummaryInfo.Subject);
                        }
                        if (Operators.CompareString(acadSummaryInfo.Author, null, TextCompare: false) != 0)
                        {
                            InternAddToDictLine(ref rlngIdx, 9, "$AUTHOR");
                            InternAddToDictLine(ref rlngIdx, 1, acadSummaryInfo.Author);
                        }
                        if (Operators.CompareString(acadSummaryInfo.Keywords, null, TextCompare: false) != 0)
                        {
                            InternAddToDictLine(ref rlngIdx, 9, "$KEYWORDS");
                            InternAddToDictLine(ref rlngIdx, 1, acadSummaryInfo.Keywords);
                        }
                        if (Operators.CompareString(acadSummaryInfo.Comments, null, TextCompare: false) != 0)
                        {
                            InternAddToDictLine(ref rlngIdx, 9, "$COMMENTS");
                            InternAddToDictLine(ref rlngIdx, 1, acadSummaryInfo.Comments);
                        }
                        if (Operators.CompareString(acadSummaryInfo.LastSavedBy, null, TextCompare: false) != 0)
                        {
                            InternAddToDictLine(ref rlngIdx, 9, "$LASTSAVEDBY");
                            InternAddToDictLine(ref rlngIdx, 1, acadSummaryInfo.LastSavedBy);
                        }
                        if (Operators.CompareString(acadSummaryInfo.RevisionNumber, null, TextCompare: false) != 0)
                        {
                            InternAddToDictLine(ref rlngIdx, 9, "$REVISIONNUMBER");
                            InternAddToDictLine(ref rlngIdx, 1, acadSummaryInfo.RevisionNumber);
                        }
                        acadSummaryInfo = null;
                        try
                        {
                            enumerator2 = dobjAcadSummaryInfo.Fields.GetValues().GetEnumerator();
                            while (enumerator2.MoveNext())
                            {
                                dobjAcadSummaryInfoField = (AcadSummaryInfoField)enumerator2.Current;
                                AcadSummaryInfoField acadSummaryInfoField = dobjAcadSummaryInfoField;
                                InternAddToDictLine(ref rlngIdx, 9, "$CUSTOMPROPERTYTAG");
                                InternAddToDictLine(ref rlngIdx, 1, acadSummaryInfoField.Key);
                                InternAddToDictLine(ref rlngIdx, 9, "$CUSTOMPROPERTY");
                                InternAddToDictLine(ref rlngIdx, 1, acadSummaryInfoField.Value);
                                acadSummaryInfoField = null;
                            }
                        }
                        finally
                        {
                            if (enumerator2 is IDisposable)
                            {
                                (enumerator2 as IDisposable).Dispose();
                            }
                        }
                    }
                }
                dobjAcadSummaryInfoField = null;
                dobjAcadSummaryInfo      = null;
                dobjAcadSysVar           = null;
                dobjDictPos2             = null;
                SysVar dobjSysVar2 = null;
                dobjSysVars2 = null;
            }
        }