コード例 #1
0
ファイル: UserDataSource.cs プロジェクト: paraneye/WinApp
        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;
        }
コード例 #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;
        }
コード例 #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;
        }
コード例 #4
0
        public async Task<bool> SaveProjectModule(int curproject, string curdiscipline)
        {
             bool retValue = false;
             WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

             try
             {
                 var projects = this.GetAllProject();
                 var modules = this.GetAllModule();

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

                 //Save Module
                 xmlstream = helper.EncryptHashSerializeTo<List<DataItem>>(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, curdiscipline);
             }
             catch (Exception e)
             {
                 helper.ExceptionHandler(e, "SaveProjectModule");
                 throw e;
             }

             return retValue;
        }
コード例 #5
0
ファイル: ITR_Master.xaml.cs プロジェクト: paraneye/WinApp
        public async Task<bool> SaveToQaqcformtemplate(List<QaqcformtemplateDTO> dto, Windows.Storage.StorageFolder _path, string _filename)
        {
            bool retValue = false;
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                var xmlstream = FormSerialize.EncryptHashSerializeTo<List<QaqcformtemplateDTO>>(dto);
                retValue =  await helper.SaveFileStream(_path, _filename, xmlstream);
                
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, "SaveToQaqcformtemplate");
                throw e;
            }

            return retValue;
        }
コード例 #6
0
ファイル: Login.xaml.cs プロジェクト: paraneye/WinApp
        private async Task<Dictionary<string, RevealUserSvc.MobileLoginDTO>> GetLoginUserInfo()
        {
            Dictionary<string, RevealUserSvc.MobileLoginDTO> retValue = new Dictionary<string, RevealUserSvc.MobileLoginDTO>();
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                //Get Crew BrassSignIn List
                var stream = await helper.GetFileStream(Lib.ContentPath.OffModeLoginFolder, Lib.ContentPath.LoginAccount);
                var list = await (new WinAppLibrary.Utilities.Helper()).EncryptDeserializeFrom<RevealUserSvc.MobileLoginDTO>(stream);
                retValue.Add(Lib.HashKey.Key_LoginAccount, list);
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, "LoginInfo");
                throw e;
            }

            return retValue;
        }
コード例 #7
0
ファイル: MainMenu.xaml.cs プロジェクト: paraneye/WinApp
        private async Task<Dictionary<string, List<RevealProjectSvc.ToolboxsignDTO>>> GetToolboxinList()
        {
            Dictionary<string, List<RevealProjectSvc.ToolboxsignDTO>> retValue = new Dictionary<string, List<RevealProjectSvc.ToolboxsignDTO>>();
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                //Get ToolboxIn List
                var stream = await helper.GetFileStream(Lib.ContentPath.OffModeUserFolder, Lib.ContentPath.ToolBoxTalk);
                var list = await (new WinAppLibrary.Utilities.Helper()).EncryptDeserializeFrom<List<RevealProjectSvc.ToolboxsignDTO>>(stream);
                retValue.Add(Lib.HashKey.Key_ToolboxIn, list);
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, "GetGrouping-ToolboxIn");
                throw e;
            }

            return retValue;
        }
コード例 #8
0
ファイル: DrawingDataSource.cs プロジェクト: paraneye/WinApp
        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;
        }
コード例 #9
0
ファイル: DrawingDataSource.cs プロジェクト: paraneye/WinApp
        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;
        }
コード例 #10
0
ファイル: DrawingDataSource.cs プロジェクト: paraneye/WinApp
        private async Task<ObservableCollection<RevealProjectSvc.DocumentnoteDTO>> GetDocumentNote()
        {
            ObservableCollection<RevealProjectSvc.DocumentnoteDTO> retValue = new ObservableCollection<RevealProjectSvc.DocumentnoteDTO>();
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                //Get Sticky Note
                var stream = await helper.GetFileStream(ContentPath.OffModeFolder, ContentPath.DocumentNote);
                retValue = await helper.EncryptDeserializeFrom<ObservableCollection<RevealProjectSvc.DocumentnoteDTO>>(stream);
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, "GetStickyNote");
                throw e;
            }

            return retValue;
        }
コード例 #11
0
ファイル: DrawingDataSource.cs プロジェクト: paraneye/WinApp
        private async Task<Dictionary<string, List<RevealCommonSvc.ComboBoxDTO>>> GetGrouping()
        {
            Dictionary<string, List<RevealCommonSvc.ComboBoxDTO>> retValue = new Dictionary<string, List<RevealCommonSvc.ComboBoxDTO>>();
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                //Get CWP
                var stream = await helper.GetFileStream(ContentPath.OffModeFolder, ContentPath.GroupingCWP);
                var list = await (new WinAppLibrary.Utilities.Helper()).EncryptDeserializeFrom<List<RevealCommonSvc.ComboBoxDTO>>(stream);
                retValue.Add(HashKey.Key_CWP, list);
                //Get FIWP
                stream = await helper.GetFileStream(ContentPath.OffModeFolder, ContentPath.GroupingFIWP);
                list = await (new WinAppLibrary.Utilities.Helper()).EncryptDeserializeFrom<List<RevealCommonSvc.ComboBoxDTO>>(stream);
                retValue.Add(HashKey.Key_FIWP, list);
                //Get Drawing Type
                stream = await helper.GetFileStream(ContentPath.OffModeFolder, ContentPath.GroupingDrawingType);
                list = await helper.EncryptDeserializeFrom<List<RevealCommonSvc.ComboBoxDTO>>(stream);
                retValue.Add(HashKey.Key_DrawingType, list);
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, "GetGrouping");
                throw e;
            }

            return retValue;
        }
コード例 #12
0
ファイル: DrawingDataSource.cs プロジェクト: paraneye/WinApp
        public async Task<bool> GetDrawingOffMode(int curpage)
        {
            bool retValue = false;
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                if (_drawingpage_off == null)
                {
                    var stream = await helper.GetFileStream(ContentPath.OffModeFolder, ContentPath.DrawingSource);
                    _drawingpage_off = await helper.EncryptDeserializeFrom<RevealProjectSvc.DrawingPageTotal>(stream);
                }

                if (_drawingpage_off != null && _drawingpage_off.drawing != null)
                {
                    int from = (int)Math.Min(Math.Floor(_drawingpage_off.drawing.Count / (double)ItemCount), curpage - 1);
                    int count = (int)Math.Min(_drawingpage_off.drawing.Count - from * ItemCount, ItemCount);

                    _drawingpage.drawing = _drawingpage_off.drawing.GetRange(from * ItemCount, count);
                    _drawingpage.CurrentPage = from + 1;
                    _drawingpage.TotalPageCount = (int)Math.Ceiling(_drawingpage_off.drawing.Count / (double)ItemCount);
                    retValue = true;
                }
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, "GetDrawingOffMode");
                throw e;
            }

            return retValue;
        }