示例#1
0
        //这个就是把界面上的查询条件(后来存入了 mListUCConditionItems 里面),放到mListQueryConditionDetails里面
        private void CreateConditionResultList()
        {
            try
            {
                ListTransParams.Clear();
                StatisticParam SP = GetValueFromPage();
                if (SP.StatisticalParamID == 0)
                {
                    return;
                }
                OperationReturn optReturn = XMLHelper.SeriallizeObject <StatisticParam>(SP);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("CreateConditionResultList Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                string StatisticC = optReturn.Data as string;
                ListTransParams.Add(StatisticC);

                for (int i = 0; i < mListABCDItems.Count; i++)
                {
                    StatisticalParamItemModel ItemModel = mListABCDItems[i];
                    ItemModel.abcdItem.CurrentApp = CurrentApp;
                    ItemModel.abcdItem.GetValue();
                    StatisticalParamItem SPI = ItemModel.abcdItem.ResultValues;
                    if (SPI.IsUsed == true && (SPI.Value == null || SPI.Value.Replace(" ", "") == string.Empty))
                    {
                        //勾选了,但是没有写值
                        CurrentApp.GetLanguageInfo("3108T003", "勾选了,但是没有写值");
                        return;
                    }
                    if (SPI.IsUsed == false)
                    {
                        continue;
                    }
                    optReturn = XMLHelper.SeriallizeObject <StatisticalParamItem>(SPI);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("CreateConditionResultList Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    StatisticC = optReturn.Data as string;
                    ListTransParams.Add(StatisticC);
                    //ListABCDItems更新
                    int index = ListABCDItems.FindIndex(p => p.StatisticalParamItemID == SPI.StatisticalParamItemID);
                    ListABCDItems[index] = SPI;
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
示例#2
0
        private void InitmListABCDItems()
        {
            try
            {
                if (mListABCDItems == null)
                {
                    return;
                }
                mListABCDItems.Clear();

                //string ItemID = Statistic.StatisticalParamID.ToString();
                //List<StatisticalParamItem> ItemParamTemplateList = (from item in ListABCDItems
                //                                                  where item.StatisticalParamID.ToString() == ItemID
                //                                                  orderby item.SortID
                //                                                  select item).ToList();
                if (ListABCDItems == null || ListABCDItems.Count == 0)
                {
                    return;
                }

                for (int i = 0; i < ListABCDItems.Count; i++)
                {
                    StatisticalParamItemModel ItemModel = new StatisticalParamItemModel(ListABCDItems[i], CurrentApp);
                    Dispatcher.Invoke(new Action(() => { mListABCDItems.Add(ItemModel); }));
                }

                InitStatisticConfig();//获取大项,如果绑定了机构的话。更新现有大项(52+26)
                if (Statistic == null)
                {
                    return;
                }
                if (Statistic.StatisticKey != 0)
                {
                    try
                    {
                        //(44)
                        WebRequest webRequest = new WebRequest();
                        webRequest.Code    = (int)S3108Codes.GetOrgItemRelation;
                        webRequest.Session = CurrentApp.Session;
                        webRequest.ListData.Add(Statistic.StatisticKey.ToString());
                        Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                           WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
                        WebHelper.SetServiceClient(client);
                        //Service31081Client client = new Service31081Client();
                        WebReturn webReturn = client.DoOperation(webRequest);
                        client.Close();
                        if (!webReturn.Result)
                        {
                            ShowException(string.Format("InitmListABCDItems Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                            return;
                        }
                        for (int i = 0; i < webReturn.ListData.Count; i += 2)
                        {
                            string Code  = webReturn.ListData[i];
                            string Value = webReturn.ListData[i + 1];

                            for (int j = 0; j < mListABCDItems.Count; j++)
                            {
                                if (Code == mListABCDItems[j].StatisticalParamItemID.ToString())
                                {
                                    string[] StrValue = mListABCDItems[j].Value.Split('?');
                                    mListABCDItems[j].Value  = string.Format("{0}?{1}?{2}", Value, StrValue[1], StrValue[2]);
                                    mListABCDItems[j].IsUsed = true;
                                    break;
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ShowException(ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }