Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 private void LoadAvaliableAgent(OrgUserItem parentItem, string parentID)
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Session = CurrentApp.Session;
         webRequest.Code    = (int)S3101Codes.GetCtrolAgent;
         webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
         webRequest.ListData.Add(parentID);
         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.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         if (webReturn.ListData == null)
         {
             ShowException(string.Format("Fail.\tListData is null"));
             return;
         }
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             string   strInfo = webReturn.ListData[i];
             string[] arrInfo = strInfo.Split(new[] { ConstValue.SPLITER_CHAR },
                                              StringSplitOptions.RemoveEmptyEntries);
             if (arrInfo.Length < 3)
             {
                 continue;
             }
             string      strID       = arrInfo[0];
             string      strName     = arrInfo[1];
             string      strFullName = arrInfo[2];
             OrgUserItem item        = new OrgUserItem();
             item.ObjType     = ConstValue.RESOURCE_AGENT;
             item.ObjID       = Convert.ToInt64(strID);
             item.Name        = strName;
             item.Description = strFullName;
             item.Data        = strInfo;
             item.Icon        = "Images/user_suit.png";
             Dispatcher.Invoke(new Action(() => parentItem.AddChild(item)));
             mListOrgUserItems.Add(item);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 3
0
        private void SaveScoreSheetData(ScoreSheet scoreSheet)
        {
            try
            {
                OperationReturn optReturn = XMLHelper.SeriallizeObject(scoreSheet);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S3101Codes.SaveScoreSheetInfo;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
                webRequest.ListData.Add(optReturn.Data.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.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                CurrentApp.WriteLog("SaveScoreSheet", webReturn.Data);

                #region 写操作日志

                //string strLog = string.Format("{0} {1} ", Utils.FormatOptLogString("COL3101001Name"),
                //    scoreSheet.Title);
                //strLog += string.Format("{0} {1} ", Utils.FormatOptLogString("COL3101001TotalScore"),
                //    scoreSheet.TotalScore);
                //strLog += string.Format("{0} {1} ", Utils.FormatOptLogString("COL3101001ViewClassic"),
                // Utils.FormatOptLogString(string.Format("3101Tip002{0}", (int)scoreSheet.ViewClassic)));
                //strLog += string.Format("{0} {1} ", Utils.FormatOptLogString("COL3101001ScoreType"),
                // Utils.FormatOptLogString(string.Format("3101Tip003{0}", (int)scoreSheet.ScoreType)));
                //CurrentApp.WriteOperationLog(CurrentApp.IsModifyScoreSheet ?
                //    S3101Consts.OPT_MODIFYSCORESHEET.ToString() : S3101Consts.OPT_CREATESCORESHEET.ToString(),
                //    ConstValue.OPT_RESULT_SUCCESS, strLog);

                #endregion

                //ShowInformation(CurrentApp.GetMessageLanguageInfo("002", "Save ScoreSheet end"));
                //mIsChanged = false;
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Esempio n. 4
0
        //private void SaveScoreSheetData(ScoreSheet scoreSheet)
        //{
        //    try
        //    {
        //        OperationReturn optReturn = XMLHelper.SeriallizeObject(scoreSheet);
        //        if (!optReturn.Result)
        //        {
        //            ShowException(string.Format("{0}\t{1}", optReturn.Code, optReturn.Message));
        //            return;
        //        }
        //        WebRequest webRequest = new WebRequest();
        //        webRequest.Code = (int)S3101Codes.SaveScoreSheetInfo;
        //        webRequest.Session = CurrentApp.Session;
        //        webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
        //        webRequest.ListData.Add(optReturn.Data.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.\t{0}\t{1}", webReturn.Code, webReturn.Message));
        //            return;
        //        }
        //        CurrentApp.WriteLog("SaveScoreSheet", webReturn.Data);

        //        #region 写操作日志

        //        //string strLog = string.Format("{0} {1} ", Utils.FormatOptLogString("COL3101001Name"),
        //        //    scoreSheet.Title);
        //        //strLog += string.Format("{0} {1} ", Utils.FormatOptLogString("COL3101001TotalScore"),
        //        //    scoreSheet.TotalScore);
        //        //strLog += string.Format("{0} {1} ", Utils.FormatOptLogString("COL3101001ViewClassic"),
        //        // Utils.FormatOptLogString(string.Format("3101Tip002{0}", (int)scoreSheet.ViewClassic)));
        //        //strLog += string.Format("{0} {1} ", Utils.FormatOptLogString("COL3101001ScoreType"),
        //        // Utils.FormatOptLogString(string.Format("3101Tip003{0}", (int)scoreSheet.ScoreType)));
        //        //CurrentApp.WriteOperationLog(CurrentApp.IsModifyScoreSheet ?
        //        //    S3101Consts.OPT_MODIFYSCORESHEET.ToString() : S3101Consts.OPT_CREATESCORESHEET.ToString(),
        //        //    ConstValue.OPT_RESULT_SUCCESS, strLog);

        //        #endregion

        //        //ShowInformation(CurrentApp.GetMessageLanguageInfo("002", "Save ScoreSheet end"));
        //        //mIsChanged = false;
        //    }
        //    catch (Exception ex)
        //    {
        //        ShowException(ex.Message);
        //    }
        //}

        //private long GetSerialID()
        //{
        //    try
        //    {
        //        WebRequest webRequest = new WebRequest();
        //        webRequest.Code = (int)RequestCode.WSGetSerialID;
        //        webRequest.Session = CurrentApp.Session;
        //        webRequest.ListData.Add("31");
        //        webRequest.ListData.Add("301");
        //        webRequest.ListData.Add(DateTime.Now.ToString("yyyyMMddHHmmss"));
        //        Service11012Client client = new Service11012Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
        //            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11012"));
        //        WebReturn webReturn = client.DoOperation(webRequest);
        //        client.Close();
        //        if (!webReturn.Result)
        //        {
        //            ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
        //            return -1;
        //        }
        //        long id = Convert.ToInt64(webReturn.Data);
        //        return id;
        //    }
        //    catch (Exception ex)
        //    {
        //        App.ShowExceptionMessage(ex.Message);
        //        return -1;
        //    }
        //}


        private void LoadScoreSheetData(BasicScoreSheetInfo scoreSheetInfo)
        {
            try
            {
                if (scoreSheetInfo != null)
                {
                    WebRequest webRequest = new WebRequest();
                    webRequest.Code    = (int)S3101Codes.GetScoreSheetInfo;
                    webRequest.Session = CurrentApp.Session;
                    webRequest.ListData.Add(scoreSheetInfo.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)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                        return;
                    }
                    OperationReturn optReturn = XMLHelper.DeserializeObject <ScoreSheet>(webReturn.Data);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    ScoreSheet scoreSheet = optReturn.Data as ScoreSheet;
                    if (scoreSheet == null)
                    {
                        ShowException(string.Format("ScoreSheet is null"));
                        return;
                    }
                    scoreSheet.ScoreSheet = scoreSheet;
                    scoreSheet.Init();
                    mExportScoreSheet = scoreSheet;
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Esempio n. 5
0
 private void LoadScoreSheetUser()
 {
     try
     {
         if (ScoreSheetItem == null)
         {
             return;
         }
         string     scoreSheetID = ScoreSheetItem.ID.ToString();
         WebRequest webRequest   = new WebRequest();
         webRequest.Code    = (int)S3101Codes.GetScoreSheetUserList;
         webRequest.Session = CurrentApp.Session;
         webRequest.ListData.Add(scoreSheetID);
         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.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         if (webReturn.ListData == null)
         {
             ShowException(string.Format("WebReturn ListData is null"));
             return;
         }
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             mListScoreSheetUsers.Add(webReturn.ListData[i]);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 6
0
        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();
                }
            }
        }
Esempio n. 7
0
        private void SetScoreSheetUser()
        {
            if (ScoreSheetItem == null)
            {
                return;
            }
            List <string> listObjectState = new List <string>();

            SetScoreSheetUser(mRootItem, ref listObjectState);

            if (listObjectState.Count > 0)
            {
                if (PageParent != null)
                {
                    PageParent.SetBusy(true, string.Empty);
                }
                mWorker         = new BackgroundWorker();
                mWorker.DoWork += (s, de) =>
                {
                    try
                    {
                        int        count      = listObjectState.Count;
                        WebRequest webRequest = new WebRequest();
                        webRequest.Session = CurrentApp.Session;
                        webRequest.Code    = (int)S3101Codes.SetScoreSheetUser;
                        webRequest.ListData.Add(ScoreSheetItem.ID.ToString());
                        webRequest.ListData.Add(count.ToString());
                        for (int i = 0; i < count; i++)
                        {
                            webRequest.ListData.Add(listObjectState[i]);
                        }
                        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.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                            return;
                        }
                        CurrentApp.WriteLog("SetScoreSheetUser", webReturn.Data);

                        #region 写操作日志

                        string        strAdded      = string.Empty;
                        string        strRemoved    = string.Empty;
                        List <string> listLogParams = new List <string>();
                        if (webReturn.ListData != null && webReturn.ListData.Count > 0)
                        {
                            for (int i = 0; i < webReturn.ListData.Count; i++)
                            {
                                string   strInfo  = webReturn.ListData[i];
                                string[] arrInfos = strInfo.Split(new[] { ConstValue.SPLITER_CHAR },
                                                                  StringSplitOptions.RemoveEmptyEntries);
                                if (arrInfos.Length >= 2)
                                {
                                    if (arrInfos[0] == "A")
                                    {
                                        var objItem =
                                            mListOrgUserItems.FirstOrDefault(o => o.ObjID.ToString() == arrInfos[1]);
                                        if (objItem != null)
                                        {
                                            strAdded += objItem.Name + ",";
                                        }
                                        else
                                        {
                                            strAdded += arrInfos[1] + ",";
                                        }
                                    }
                                    if (arrInfos[0] == "D")
                                    {
                                        var objItem =
                                            mListOrgUserItems.FirstOrDefault(o => o.ObjID.ToString() == arrInfos[1]);
                                        if (objItem != null)
                                        {
                                            strRemoved += objItem.Name + ",";
                                        }
                                        else
                                        {
                                            strRemoved += arrInfos[1] + ",";
                                        }
                                    }
                                }
                            }
                            strAdded   = strAdded.TrimEnd(new[] { ',' });
                            strRemoved = strRemoved.TrimEnd(new[] { ',' });
                        }
                        listLogParams.Add(strAdded);
                        listLogParams.Add(strRemoved);
                        CurrentApp.WriteOperationLog(S3101Consts.OPT_SETMANAGEUSER.ToString(), ConstValue.OPT_RESULT_SUCCESS, "3101Log0001", listLogParams);

                        #endregion

                        ShowInformation(CurrentApp.GetMessageLanguageInfo("004", "Set ScoreSheet user end"));
                    }
                    catch (Exception ex)
                    {
                        ShowException(ex.Message);
                    }
                };
                mWorker.RunWorkerCompleted += (s, re) =>
                {
                    mWorker.Dispose();
                    if (PageParent != null)
                    {
                        PageParent.SetBusy(false, string.Empty);
                    }
                    var parent = Parent as PopupPanel;
                    if (parent != null)
                    {
                        parent.IsOpen = false;
                    }
                };
                mWorker.RunWorkerAsync();
            }
        }