예제 #1
0
        public KpiMapObjectInfoItem(KpiMapObjectInfo kpiMapObjectInfo)
        {
            KPIName      = kpiMapObjectInfo.KpiName;
            ObjectType   = kpiMapObjectInfo.ApplyType;
            IsActive     = kpiMapObjectInfo.IsActive;
            StartTime    = Converter.NumberToDatetime(kpiMapObjectInfo.StartTime).ToString();
            StopTime     = Converter.NumberToDatetime(kpiMapObjectInfo.StopTime).ToString();
            DropDown     = kpiMapObjectInfo.DropDown;
            ApplyAll     = kpiMapObjectInfo.ApplyAll;
            AdderName    = kpiMapObjectInfo.AdderName;
            AddTime      = Converter.NumberToDatetime(kpiMapObjectInfo.AddTime).ToString();
            GoldValue1   = kpiMapObjectInfo.GoalOperation1 + kpiMapObjectInfo.GoldValue1;
            GoldValue2   = kpiMapObjectInfo.GoalOperation1 + kpiMapObjectInfo.GoldValue2;
            ApplyCycle   = kpiMapObjectInfo.ApplyCycle;
            BelongOrgSkg = kpiMapObjectInfo.BelongOrgSkgName;

            KpiMapObjectInfo = kpiMapObjectInfo;
        }
 public void LoadKpiMapObjectInfo()
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S4601Codes.LoadKpiMapObjectInfo;
         webRequest.Session = CurrentApp.Session;
         webRequest.ListData.Add(mCurrentObjectItem.ObjID.ToString());    //对象ID
         webRequest.ListData.Add(mCurrentObjectItem.ParantID.ToString()); //对象的ParantID
         Service46011Client client = new Service46011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service46011"));
         //Service46011Client client = new Service46011Client();
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         mlistKpiMapObjectInfo.Clear();
         mListKpiMapObjectInfoItem.Clear();
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             OperationReturn optReturn = XMLHelper.DeserializeObject <KpiMapObjectInfo>(webReturn.ListData[i]);
             if (!optReturn.Result)
             {
                 ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return;
             }
             KpiMapObjectInfo kpiInfo = optReturn.Data as KpiMapObjectInfo;
             if (kpiInfo != null)
             {
                 mlistKpiMapObjectInfo.Add(kpiInfo);
             }
             KpiMapObjectInfoItem item = new KpiMapObjectInfoItem(kpiInfo);
             //新增的属性 每个绑定的数据源里都有一个对象 然后就将选中的对象赋过去
             item.ObjectItem = mCurrentObjectItem;
             mListKpiMapObjectInfoItem.Add(item);
         }
         for (int i = 0; i < mListKpiMapObjectInfoItem.Count; i++)
         {
             KpiMapObjectInfoItem item = mListKpiMapObjectInfoItem[i];
             item.StrKPIName    = CurrentApp.GetLanguageInfo(string.Format("4601KPI{0}", item.KpiMapObjectInfo.KpiID), item.KPIName.ToString());
             item.StrApplyCycle = CurrentApp.GetLanguageInfo(string.Format("4601BP{0}", item.ApplyCycle), item.ApplyCycle.ToString());
             item.StrIsActive   = CurrentApp.GetLanguageInfo(string.Format("4601IsActive{0}", item.IsActive), item.IsActive.ToString());
             item.StrDropDown   = CurrentApp.GetLanguageInfo(string.Format("4601BPDropDown{0}", item.DropDown), item.DropDown.ToString());
             item.StrApplyAll   = CurrentApp.GetLanguageInfo(string.Format("4601BPApplyAll{0}", item.ApplyAll), item.ApplyAll.ToString());
             if (Regex.Matches(item.ObjectType, @"1").Count > 1)//这个字符串中1的个数大于1
             {
                 item.StrObjectType = string.Empty;
                 if (item.ObjectType.Substring(0, 1) == "1")
                 {
                     item.StrObjectType += CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", "1000000000"), "1000000000") + "  ";
                 }
                 if (item.ObjectType.Substring(1, 1) == "1")
                 {
                     item.StrObjectType += CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", "0100000000"), "0100000000") + "  ";
                 }
                 if (item.ObjectType.Substring(2, 1) == "1")
                 {
                     item.StrObjectType += CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", "0010000000"), "0010000000") + "  ";
                 }
                 if (item.ObjectType.Substring(3, 1) == "1")
                 {
                     item.StrObjectType += CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", "0001000000"), "0001000000") + "  ";
                 }
             }
             else
             {
                 item.StrObjectType = CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", item.ObjectType), item.ObjectType.ToString());
             }
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }