Exemplo n.º 1
0
        public async Task<bool> SaveFileLoginAccount(object dtolist, string strkeyvalue)
        {
            bool retValue = false;
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                var xmlstream = helper.EncryptSerializeTo<RevealUserSvc.MobileLoginDTO>(dtolist);
                await helper.SaveFileStream(ContentPath.OffModeLoginFolder, Lib.ContentPath.LoginAccount, xmlstream);
                WinAppLibrary.Utilities.Helper.SetValueInStorage(Lib.HashKey.Key_LoginAccount, strkeyvalue);

                retValue = true;
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, strkeyvalue);
                throw e;
            }

            return retValue;
        }
Exemplo n.º 2
0
        public async Task<bool> SaveFileDayilyBrassSign(object dtolist, string strkeyvalue)
        {
            bool retValue = false;
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                var xmlstream = helper.EncryptSerializeTo<List<RevealProjectSvc.DailybrasssignDTO>>(dtolist);
                await helper.SaveFileStream(ContentPath.OffModeUserFolder, Lib.ContentPath.BrassSignIn, xmlstream);
                WinAppLibrary.Utilities.Helper.SetValueInStorage(Lib.HashKey.Key_CrewBrassIn, strkeyvalue);

                retValue = true;
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, strkeyvalue);
                throw e;
            }

            return retValue;
        }
Exemplo n.º 3
0
        public async Task<bool> SaveProjectModuleFull(int curproject, int curmodule)
        {
            bool retValue = false;
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                var projects = await (new ServiceModel.ProjectModel()).GetAllProject();
                var modules = await (new ServiceModel.CommonModel()).GetAllModule();

                //Save project
                var xmlstream = helper.EncryptSerializeTo<List<RevealProjectSvc.ProjectDTO>>(projects);
                await helper.SaveFileStream(ContentPath.OffModeFolder, Lib.ContentPath.ProjectSource, xmlstream);

                //Save Module
                xmlstream = helper.EncryptSerializeTo<List<RevealCommonSvc.ModuleDTO>>(modules);
                await helper.SaveFileStream(ContentPath.OffModeFolder, Lib.ContentPath.ModuleSource, xmlstream);

                WinAppLibrary.Utilities.Helper.SetValueInStorage(Lib.HashKey.Key_Project, curproject);
                WinAppLibrary.Utilities.Helper.SetValueInStorage(Lib.HashKey.Key_Module, curmodule);
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, "SaveProjectModuleFull");
                throw e;
            }

            return retValue;
        }
Exemplo n.º 4
0
        public async Task<bool> SaveDrawingOption(Dictionary<string, ObservableCollection<RevealCommonSvc.ComboBoxDTO>> options,
            ObservableCollection<RevealProjectSvc.DocumentnoteDTO> notes,
            string engtag, string title, string sortoption)
        {
            bool retValue = false;
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                Stream xmlstream = helper.EncryptSerializeTo<List<RevealCommonSvc.ComboBoxDTO>>(options[HashKey.Key_CWP].ToList());
                await helper.SaveFileStream(ContentPath.OffModeFolder, ContentPath.GroupingCWP, xmlstream);

                xmlstream = helper.EncryptSerializeTo<List<RevealCommonSvc.ComboBoxDTO>>(options[HashKey.Key_FIWP].ToList());
                await helper.SaveFileStream(ContentPath.OffModeFolder, ContentPath.GroupingFIWP, xmlstream);

                xmlstream = helper.EncryptSerializeTo<List<RevealCommonSvc.ComboBoxDTO>>(options[HashKey.Key_DrawingType].ToList());
                await helper.SaveFileStream(ContentPath.OffModeFolder, ContentPath.GroupingDrawingType, xmlstream);

                xmlstream = helper.EncryptSerializeTo<ObservableCollection<RevealProjectSvc.DocumentnoteDTO>>(notes);
                await helper.SaveFileStream(ContentPath.OffModeFolder, ContentPath.DocumentNote, xmlstream);

                WinAppLibrary.Utilities.Helper.SetValueInStorage(HashKey.Key_EngTag, engtag);
                WinAppLibrary.Utilities.Helper.SetValueInStorage(HashKey.Key_Title, title);
                WinAppLibrary.Utilities.Helper.SetValueInStorage(HashKey.Key_Sort, sortoption);

                //This was banned for temporary until finding alternative as Windows Apps doesn't support serialize Dictionary with List for value.
                //Stream xmlstream = helper.EncryptHashSerializeTo<Dictionary<string, List<WinAppLibrary.RevealCommonSvc.ComboBoxDTO>>>(options);
                //await helper.SaveFileStream(ContentPath.OffModeFolder, ContentPath.GroupingSource, xmlstream);

                retValue = true;
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, "SaveDrawingOption");
                throw e;
            }

            return retValue;
        }
Exemplo n.º 5
0
        public async Task<bool> SaveDrawing(int projectId, int moduleId, string enTag, string title, string sortoption)
        {
            bool retValue = false;
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                Stream xmlstream;
                var drawingpagetotal = await (new Lib.ServiceModel.ProjectModel()).GetDrawingForDrawingViewer(projectId,
                                _grouplist[Lib.HashKey.Key_CWP].Where(x => x.ParentID > 0).Select(x => x.DataID).ToList(),
                                _grouplist[Lib.HashKey.Key_FIWP].Where(x => x.ParentID > 0).Select(x => x.DataID).ToList(),
                                _grouplist[Lib.HashKey.Key_DrawingType].Where(x => x.ParentID > 0).Select(x => x.DataID).ToList(),
                                enTag, title, sortoption, 1);

                if (drawingpagetotal != null && drawingpagetotal.drawing != null && drawingpagetotal.drawing.Count > 0)
                {
                    foreach (var d in drawingpagetotal.drawing)
                    {
                        var stream = await helper.GetImageStreamFromUri(new Uri(d.DrawingFilePath + d.DrawingFileURL));
                        if (stream == null)
                            stream = await helper.GetImageStreamFromUri(new Uri(WinAppLibrary.Utilities.Helper.BaseUri + ContentPath.DefaultDrawing));

                        await helper.SaveFileStream(ContentPath.OffModeFolder, d.DrawingFileURL, stream);
                        d.DrawingFilePath = ContentPath.OffModeFolder.Path + "\\";
                    }
                }

                xmlstream = helper.EncryptSerializeTo<RevealProjectSvc.DrawingPageTotal>(drawingpagetotal);
                await helper.SaveFileStream(ContentPath.OffModeFolder, ContentPath.DrawingSource, xmlstream);

                await SaveDrawingOption(_grouplist, _documentnote, enTag, title, sortoption);
                retValue = true;
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, "SaveDrawing");
                throw e;
            }

            return retValue;
        }