コード例 #1
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
        public BasicScoreSheetInfo InitExportScoreSheet(ScoreSheetItem item)
        {
            try
            {
                BasicScoreSheetInfo scoreSheetItemInfo = new BasicScoreSheetInfo();

                scoreSheetItemInfo.ID          = item.ID;
                scoreSheetItemInfo.Name        = item.Name;
                scoreSheetItemInfo.State       = item.State;
                scoreSheetItemInfo.TotalScore  = item.TotalScore;
                scoreSheetItemInfo.ViewClassic = item.ViewClassic;
                scoreSheetItemInfo.ScoreType   = item.ScoreType;
                scoreSheetItemInfo.UseFlag     = item.UseFlag;
                scoreSheetItemInfo.ItemCount   = item.ItemCount;
                scoreSheetItemInfo.Description = item.Description;
                //OperationReturn temp = XMLHelper.SeriallizeObject<BasicScoreSheetInfo>(scoreSheetItemInfo);

                return(scoreSheetItemInfo);
            }
            catch (Exception ex)
            {
                ShowInformation(ex.Message);
                return(null);
            }
        }
コード例 #2
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
        private void LoadScoreSheets()
        {
            try
            {
                ClearChildItem();
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S3101Codes.GetScoreSheetList;
                webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
                Service31011Client client = new Service31011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31011"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("Fail.{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                List <string>   listScoreSheet = webReturn.ListData;
                OperationReturn optReturn;
                for (int i = 0; i < listScoreSheet.Count; i++)
                {
                    string strScoreSheetInfo = listScoreSheet[i];
                    optReturn = XMLHelper.DeserializeObject <BasicScoreSheetInfo>(strScoreSheetInfo);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    BasicScoreSheetInfo scoreSheetInfo = optReturn.Data as BasicScoreSheetInfo;
                    if (scoreSheetInfo == null)
                    {
                        ShowException(string.Format("Fail.\tScoreSheetInfo is null"));
                        return;
                    }
                    ScoreSheetItem scoreSheetItem = new ScoreSheetItem();
                    scoreSheetItem.ID             = scoreSheetInfo.ID;
                    scoreSheetItem.Name           = scoreSheetInfo.Name;
                    scoreSheetItem.State          = scoreSheetInfo.State;
                    scoreSheetItem.TotalScore     = scoreSheetInfo.TotalScore;
                    scoreSheetItem.ItemCount      = scoreSheetInfo.ItemCount;
                    scoreSheetItem.ViewClassic    = scoreSheetInfo.ViewClassic;
                    scoreSheetItem.ScoreType      = scoreSheetInfo.ScoreType;
                    scoreSheetItem.UseFlag        = scoreSheetInfo.UseFlag;
                    scoreSheetItem.Description    = scoreSheetInfo.Description;
                    scoreSheetItem.TipState       = "State:" + scoreSheetItem.State;
                    scoreSheetItem.TipViewClassic = "ViewClassic" + scoreSheetItem.ViewClassic;
                    scoreSheetItem.TipScoreType   = "ScoreType:" + scoreSheetItem.ScoreType;
                    scoreSheetItem.Data           = scoreSheetInfo;
                    AddChildItem(scoreSheetItem);
                }

                CurrentApp.WriteLog("PageLoad", string.Format("Load ScoreSheet"));
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
コード例 #3
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
 private void ShowObjectDetail()
 {
     try
     {
         ScoreSheetItem item = CurrentScoreSheetItem;
         if (item == null)
         {
             return;
         }
         ObjectDetail.Title = item.Name;
         BitmapImage image = new BitmapImage();
         image.BeginInit();
         image.UriSource = new Uri(string.Format("/Themes/Default/UMPS3101/Images/template.ico"), UriKind.Relative);
         image.EndInit();
         ObjectDetail.Icon = image;
         List <PropertyItem> listProperties = new List <PropertyItem>();
         PropertyItem        property;
         property         = new PropertyItem();
         property.Name    = CurrentApp.GetLanguageInfo("3101T002", "Total Score");
         property.ToolTip = property.Name;
         property.Value   = item.TotalScore.ToString();
         listProperties.Add(property);
         property         = new PropertyItem();
         property.Name    = CurrentApp.GetLanguageInfo("3101T003", "Item Count");
         property.ToolTip = property.Name;
         property.Value   = item.ItemCount.ToString();
         listProperties.Add(property);
         property         = new PropertyItem();
         property.Name    = CurrentApp.GetLanguageInfo("3101T004", "View Classic");
         property.ToolTip = property.Name;
         property.Value   = CurrentApp.GetLanguageInfo(string.Format("3101Tip002{0}", item.ViewClassic),
                                                       string.Format("ViewClassic:{0}", item.ViewClassic));
         listProperties.Add(property);
         property         = new PropertyItem();
         property.Name    = CurrentApp.GetLanguageInfo("3101T005", "Score Type");
         property.ToolTip = property.Name;
         property.Value   = CurrentApp.GetLanguageInfo(string.Format("3101Tip003{0}", item.ScoreType),
                                                       string.Format("ScoreType:{0}", item.ScoreType));
         listProperties.Add(property);
         property         = new PropertyItem();
         property.Name    = CurrentApp.GetLanguageInfo("3101T006", "Use Flag");
         property.ToolTip = property.Name;
         property.Value   = item.UseFlag.ToString();
         listProperties.Add(property);
         property         = new PropertyItem();
         property.Name    = CurrentApp.GetLanguageInfo("3101T007", "Description");
         property.ToolTip = property.Name;
         property.Value   = item.Description;
         listProperties.Add(property);
         ObjectDetail.ItemsSource = listProperties;
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
コード例 #4
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
        void BasicOpt_Click(object sender, RoutedEventArgs e)
        {
            var btn = e.Source as Button;

            if (btn != null)
            {
                var optItem        = btn.DataContext as OperationInfo;
                var scoreSheetItem = CurrentScoreSheetItem;
                if (optItem != null)
                {
                    switch (optItem.ID)
                    {
                    case S3101Consts.OPT_CREATESCORESHEET:
                        CreateScoreSheet();
                        break;

                    case S3101Consts.OPT_MODIFYSCORESHEET:
                        if (scoreSheetItem == null)
                        {
                            return;
                        }
                        ModifyScoreSheet(scoreSheetItem);
                        break;

                    case S3101Consts.OPT_DELETESCORESHEET:
                        if (scoreSheetItem == null)
                        {
                            return;
                        }
                        DeleteScoreSheet(scoreSheetItem);
                        CurrentScoreSheetItem = null;
                        break;

                    case S3101Consts.OPT_SETMANAGEUSER:
                        if (scoreSheetItem == null)
                        {
                            return;
                        }
                        SetManageUser(scoreSheetItem);
                        break;

                    case S3101Consts.OPT_IMPORTSCORESHEET:
                        ImportScoreSheet();
                        break;

                    case S3101Consts.OPT_EXPORTSCORESHEET:
                        if (scoreSheetItem == null)
                        {
                            return;
                        }
                        ExportScoreSheet(scoreSheetItem);
                        break;
                    }
                }
            }
        }
コード例 #5
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
 private void SetManageUser(ScoreSheetItem item)
 {
     if (item != null)
     {
         PopupPanel.Title = "ScoreSheet User Management";
         ScoreUserManagement scoreUserManagement = new ScoreUserManagement();
         scoreUserManagement.PageParent     = this;
         scoreUserManagement.CurrentApp     = CurrentApp;
         scoreUserManagement.ScoreSheetItem = item;
         PopupPanel.Content = scoreUserManagement;
         PopupPanel.IsOpen  = true;
     }
 }
コード例 #6
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
        private void ExportScoreSheet(ScoreSheetItem item)
        {
            if (item != null)
            {
                PopupPanel.Title = CurrentApp.GetLanguageInfo("FO3101006", "Export ScoreSheet");

                ExportScoreSheet exportScoreSheet = new ExportScoreSheet();

                exportScoreSheet.PageParent     = this;
                exportScoreSheet.CurrentApp     = CurrentApp;
                exportScoreSheet.ScoreSheetItem = item;
                PopupPanel.Content = exportScoreSheet;
                PopupPanel.IsOpen  = true;
            }
        }
コード例 #7
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
        void LvScoreSheets_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var scoreSheetItem = LvScoreSheets.SelectedItem as ScoreSheetItem;

            if (scoreSheetItem == null)
            {
                return;
            }
            IsComplated = true;
            if (scoreSheetItem.State == 1)
            {
                IsComplated = false;
            }
            CurrentScoreSheetItem = scoreSheetItem;
            CreateOptButtons();
            ShowObjectDetail();
        }
コード例 #8
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
        private void ModifyScoreSheet(ScoreSheetItem item)
        {
            if (item != null)
            {
                //ShowInformation(string.Format("Modify scoresheet:{0}", item.Name));
                var basicScoreSheetInfo = item.Data as BasicScoreSheetInfo;
                if (basicScoreSheetInfo != null)
                {
                    S3101App.CurrentScoreSheetInfo = basicScoreSheetInfo;
                    S3101App.IsModifyScoreSheet    = true;

                    //if (NavigationService != null)
                    //    NavigationService.Navigate(new Uri("SSDMainPage.xaml", UriKind.Relative));

                    SSDMainView view = new SSDMainView();
                    view.CurrentApp        = CurrentApp;
                    view.PageName          = "SSDMainPage";
                    CurrentApp.CurrentView = view;
                    if (CurrentApp.RunAsModule)
                    {
                        CurrentApp.InitCurrentView();
                    }
                    else
                    {
                        var app = App.Current;
                        if (app != null)
                        {
                            var window = app.MainWindow;
                            if (window != null)
                            {
                                var shell = window.Content as Shell;
                                if (shell != null)
                                {
                                    shell.SetView(view);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #9
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
        private void DeleteScoreSheet(ScoreSheetItem item)
        {
            if (item != null)
            {
                if (item.UseFlag > 0)
                {
                    ShowInformation(CurrentApp.GetLanguageInfo("3101N006", "Score Sheet Was Used, Can Not Be Delete"));
                    return;
                }
                var result = MessageBox.Show(string.Format("{0}\r\n\r\n{1}",
                                                           CurrentApp.GetMessageLanguageInfo("001", "Confirm delete scoresheet?"),
                                                           item.Name),
                                             CurrentApp.AppName, MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes)
                {
                    SetBusy(true, string.Empty);
                    mWorker         = new BackgroundWorker();
                    mWorker.DoWork += (s, de) =>
                    {
                        try
                        {
                            WebRequest webRequest = new WebRequest();
                            webRequest.Session = CurrentApp.Session;
                            webRequest.Code    = (int)S3101Codes.RemoveScoreSheetInfo;
                            webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
                            webRequest.ListData.Add(item.ID.ToString());
                            Service31011Client client = new Service31011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                               WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31011"));
                            WebReturn webReturn = client.DoOperation(webRequest);
                            client.Close();
                            if (!webReturn.Result)
                            {
                                if (webReturn.Message.Equals("NoExist"))
                                {
                                    ShowInformation(CurrentApp.GetLanguageInfo("3101N005", "Score Sheet Is Not Exist"));
                                    return;
                                }
                                if (webReturn.Message.Equals("BeUsed"))
                                {
                                    ShowInformation(CurrentApp.GetLanguageInfo("3101N006", "Score Sheet Was Used, Can Not Be Delete"));
                                    return;
                                }
                                ShowException(string.Format("Fail.{0}\t{1}", webReturn.Code, webReturn.Message));
                                return;
                            }
                            LoadScoreSheets();


                            #region 写操作日志

                            string strLog = string.Format("{0} {1} ", Utils.FormatOptLogString("COL3101001Name"), item.Name);
                            CurrentApp.WriteOperationLog(S3101Consts.OPT_DELETESCORESHEET.ToString(),
                                                         ConstValue.OPT_RESULT_SUCCESS, strLog);

                            #endregion
                        }
                        catch (Exception ex)
                        {
                            ShowException(ex.Message);
                        }
                    };
                    mWorker.RunWorkerCompleted += (s, re) =>
                    {
                        mWorker.Dispose();
                        SetBusy(false, string.Empty);
                    };
                    mWorker.RunWorkerAsync();
                }
            }
        }
コード例 #10
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
        public override void ChangeLanguage()
        {
            base.ChangeLanguage();

            try
            {
                CurrentApp.AppTitle = CurrentApp.GetLanguageInfo(string.Format("FO{0}", CurrentApp.ModuleID),
                                                                 "ScoreSheet Management");

                //Operation
                string tipModify = string.Empty, tipDelete = string.Empty, tipSetUser = string.Empty, tipExport = string.Empty;
                for (int i = 0; i < ListOperations.Count; i++)
                {
                    ListOperations[i].Display = CurrentApp.GetLanguageInfo(string.Format("FO{0}", ListOperations[i].ID),
                                                                           ListOperations[i].ID.ToString());

                    if (ListOperations[i].ID == 3101002)
                    {
                        tipModify = ListOperations[i].Display;
                    }
                    if (ListOperations[i].ID == 3101003)
                    {
                        tipDelete = ListOperations[i].Display;
                    }
                    if (ListOperations[i].ID == 3101004)
                    {
                        tipSetUser = ListOperations[i].Display;
                    }
                    if (ListOperations[i].ID == 3101005)
                    {
                    }
                    if (ListOperations[i].ID == 3101006)
                    {
                        tipExport = ListOperations[i].Display;
                    }
                }
                CreateOptButtons();

                //Other
                ExpBasicOpt.Header = CurrentApp.GetLanguageInfo("31011000", "Basic Operations");
                ExpOtherPos.Header = CurrentApp.GetLanguageInfo("31011001", "Other Position");

                //列名
                InitColumns();

                //ScoreSheetItem
                for (int i = 0; i < mListScoreSheets.Count; i++)
                {
                    ScoreSheetItem item = mListScoreSheets[i];
                    item.TipState = CurrentApp.GetLanguageInfo(string.Format("3101Tip001{0}", item.State),
                                                               string.Format("State:{0}", item.State));
                    item.TipViewClassic = CurrentApp.GetLanguageInfo(string.Format("3101Tip002{0}", item.ViewClassic),
                                                                     string.Format("ViewClassic:{0}", item.ViewClassic));
                    item.TipScoreType = CurrentApp.GetLanguageInfo(string.Format("3101Tip003{0}", item.ScoreType),
                                                                   string.Format("ScoreType:{0}", item.ScoreType));

                    item.TipOptModify  = tipModify;
                    item.TipOptDelete  = tipDelete;
                    item.TipOptSetUser = tipSetUser;
                    item.TipOptExport  = tipExport;
                }

                //详细信息
                ShowObjectDetail();

                //弹出面板
                var popup = PopupPanel;
                if (popup != null)
                {
                    popup.ChangeLanguage();
                }
            }
            catch (Exception ex)
            {
                //ShowException(ex.Message);
            }
        }
コード例 #11
0
ファイル: SSMMainView.xaml.cs プロジェクト: chenmj201601/UMP
 private void AddChildItem(ScoreSheetItem item)
 {
     Dispatcher.Invoke(new Action(() => mListScoreSheets.Add(item)));
 }