Esempio n. 1
0
 //要写一个函数  作用是写入数据到T_31_050表C006字段  这个里面是放是否启动这个参数大项的设置
 public void ModifyStatisticParam()
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3108Codes.ModifyStatisticParam;
         webRequest.Session = CurrentApp.Session;
         webRequest.ListData.Add(StatisticalParam.StatisticalParamID.ToString());
         if (IsUsed.IsChecked == true)
         {
             StatisticalParam.IsUsed = "1";
         }
         else
         {
             StatisticalParam.IsUsed = "0";
         }
         webRequest.ListData.Add(StatisticalParam.IsUsed);
         Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 2
0
        private void SaveConfig()
        {
            try
            {
                if (ListTransParams.Count == 0)
                {
                    return;
                }
                if (ListTransParams.Count == 1)
                {
                    ShowInformation(CurrentApp.GetLanguageInfo("310802T002", "没有小项")); return;
                }
                string     msg        = string.Empty;
                WebRequest webRequest = new WebRequest();
                webRequest.Code     = (int)S3108Codes.SaveConfig;
                webRequest.Session  = CurrentApp.Session;
                webRequest.ListData = ListTransParams;
                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)
                {
                    ShowInformation(string.Format("{0}\n{1}", CurrentApp.GetLanguageInfo("3108T002", "保存fail"),
                                                  string.Format("SaveConfig Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)));

                    #region 记录日志
                    msg = string.Format("{0}{1}{2}:{3}", CurrentApp.Session.UserInfo.UserName, Utils.FormatOptLogString(string.Format("FO3108006")), OrgItem.Name, Statistic.StatisticalParamName);
                    CurrentApp.WriteOperationLog("3108006", ConstValue.OPT_RESULT_FAIL, msg);
                    #endregion
                    return;
                }
                // 0    大项编号
                // 1    cycletime
                // 2    rowname
                // 3    statisticKey
                int    index = 0;
                string ID    = webReturn.ListData[0];
                for (index = 0; index < ListABCD.Count(); index++)
                {
                    if (ListABCD[index].StatisticalParamID.ToString() == ID && ListABCD[index].StatisticKey == 0)
                    {
                        ListABCD[index].CycleTime    = Convert.ToInt64(webReturn.ListData[2]);
                        ListABCD[index].RowNum       = Convert.ToInt32(webReturn.ListData[1]);
                        ListABCD[index].StatisticKey = Convert.ToInt64(webReturn.ListData[3]);
                    }
                }
                ShowInformation(CurrentApp.GetLanguageInfo("3108T001", "保存成功"));
                #region 记录日志
                msg = string.Format("{0}{1}{2}:{3}", CurrentApp.Session.UserInfo.UserName, Utils.FormatOptLogString(string.Format("FO3108006")), OrgItem.Name, Statistic.StatisticalParamName);
                CurrentApp.WriteOperationLog("3108006", ConstValue.OPT_RESULT_SUCCESS, msg);
                #endregion
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Esempio n. 3
0
        public bool DeleteStatisticParamFromDB()
        {
            WebRequest webRequest = new WebRequest();

            webRequest.Code    = (int)S3108Codes.DeleteConfig;
            webRequest.Session = CurrentApp.Session;
            StatisticParam SP = new StatisticParam();

            SP.CycleTime            = DeleteStatisticParam.CycleTime;
            SP.StatisticKey         = DeleteStatisticParam.StatisticKey;
            SP.TableType            = DeleteStatisticParam.TableType;
            SP.RowNum               = DeleteStatisticParam.RowNum;
            SP.StatisticalParamID   = DeleteStatisticParam.StatisticalParamID;
            SP.StatisticalParamName = DeleteStatisticParam.StatisticalParamName;

            SP.CycleTimeParam = DeleteStatisticParam.CycleTimeParam;
            SP.IsCombine      = DeleteStatisticParam.IsCombine;
            SP.OrgID          = DeleteStatisticParam.OrgID;
            OperationReturn optReturn = XMLHelper.SeriallizeObject <StatisticParam>(SP);

            if (!optReturn.Result)
            {
                ShowException(string.Format("DeleteStatisticParamFromDB xml Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                return(false);
            }
            string StatisticC = optReturn.Data as string;

            webRequest.ListData.Add(StatisticC);
            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("deleteConfig Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                #region 记录日志
                string orgname = mListObjectItems.FirstOrDefault(p => p.ItemID == SP.OrgID.ToString()).Name;
                string msg     = string.Format("{0}{1}{2}:{3}", CurrentApp.Session.UserInfo.UserName, Utils.FormatOptLogString(string.Format("FO3108007")), orgname, SP.StatisticalParamName);
                CurrentApp.WriteOperationLog("3108007", ConstValue.OPT_RESULT_FAIL, msg);
                #endregion
                return(false);
            }
            InitListBox();
            #region 记录日志
            string orgnameT = mListObjectItems.FirstOrDefault(p => p.ItemID == SP.OrgID.ToString()).Name;
            string msgT     = string.Format("{0}{1}{2}:{3}", CurrentApp.Session.UserInfo.UserName, Utils.FormatOptLogString(string.Format("FO3108007")), orgnameT, SP.StatisticalParamName);
            CurrentApp.WriteOperationLog("3108007", ConstValue.OPT_RESULT_SUCCESS, msgT);
            #endregion
            return(true);
        }
Esempio n. 4
0
 private void InitSkillGroup()
 {
     try
     {
         ClearChildren(mRoot);
         mListObjectItems.Clear();
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3108Codes.GetSkillGroupList;
         webRequest.Session = CurrentApp.Session;
         Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
         WebHelper.SetServiceClient(client);
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("InitControledOrgs Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         List <ObjectItem> listChild = new List <ObjectItem>();
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             string orgInfo = webReturn.ListData[i];
             if (orgInfo != null)
             {
                 ObjectItem    item = new ObjectItem();
                 List <string> temp = orgInfo.Split(';').ToList();
                 if (temp.Count != 5)
                 {
                     return;
                 }
                 item.ObjID       = temp[1];
                 item.ItemID      = temp[0];
                 item.Name        = temp[2];
                 item.Description = temp[3];
                 item.ObjType     = Convert.ToInt32(temp[4]);
                 //item.Description = string.Format("{0}:{1}", temp[0], temp[1]);
                 //item.Icon = "Images/org.ico";
                 listChild.Add(item);
             }
         }
         listChild = listChild.OrderBy(o => o.ObjID).ToList();
         for (int i = 0; i < listChild.Count; i++)
         {
             mListObjectItems.Add(listChild[i]);
             AddChildObjectItem(mRoot, listChild[i]);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 5
0
        //获取参数大项里面的内容 也就是参数小项
        private void LoadParamContent()
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S3108Codes.GetSelectParamItemsInfos;
                webRequest.Session = CurrentApp.Session;
                //先传入选择的参数大项的ID
                webRequest.ListData.Add(StatisticalParam.StatisticalParamID.ToString());

                Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }

                mListParamItems.Clear();
                List <CombinedParamItemModel> templist = new List <CombinedParamItemModel>();
                mListStatisticalParamItem.Clear();
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <StatisticalParamItem>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    StatisticalParamItem item = optReturn.Data as StatisticalParamItem;//注意看这里的类型
                    mListStatisticalParamItem.Add(item);
                    if (item == null)
                    {
                        ShowException(string.Format("Fail. CustomConditionItem is null"));
                        return;
                    }

                    CombinedParamItemModel itemItem = new CombinedParamItemModel(item, CurrentApp);//再看下这里的类型  看下这个是怎么实现的
                    templist.Add(itemItem);
                }
                var itemList = templist.OrderBy(temp => temp.SortID).ToList();
                for (int i = 0; i < itemList.Count; i++)
                {
                    mListParamItems.Add(itemList[i]);
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Esempio n. 6
0
 private void InitControledOrgs(ObjectItem parentObj, string parentID)
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3108Codes.GetOrganizationList;
         webRequest.Session = CurrentApp.Session;
         webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
         webRequest.ListData.Add(parentID);
         Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
         WebHelper.SetServiceClient(client);
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("InitControledOrgs Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         List <ObjectItem> listChild = new List <ObjectItem>();
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             string orgInfo = webReturn.ListData[i];
             if (orgInfo != null)
             {
                 ObjectItem    item = new ObjectItem();
                 List <string> temp = orgInfo.Split(';').ToList();
                 if (temp.Count != 2)
                 {
                     return;
                 }
                 item.Name        = temp[1];
                 item.ItemID      = temp[0];
                 item.ObjParentID = parentID;
                 item.Description = string.Format("{0}:{1}", temp[0], temp[1]);
                 item.Icon        = "Images/org.ico";
                 InitControledOrgs(item, temp[0]);
                 listChild.Add(item);
             }
         }
         listChild = listChild.OrderBy(o => o.Name).ToList();
         for (int i = 0; i < listChild.Count; i++)
         {
             mListObjectItems.Add(listChild[i]);
             AddChildObjectItem(parentObj, listChild[i]);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 7
0
 //导入统计配置参数大项,从T_31_050
 private void InitStatisticalParam()
 {
     try
     {
         mListStatisticalParam.Clear();
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3108Codes.GetStatisticalParam;
         webRequest.Session = CurrentApp.Session;
         Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("InitStatisticalParam:Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             OperationReturn optReturn = XMLHelper.DeserializeObject <StatisticalParam>(webReturn.ListData[i]);
             if (!optReturn.Result)
             {
                 ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return;
             }
             StatisticalParam SPInfo = optReturn.Data as StatisticalParam;
             string           code   = (SPInfo.StatisticalParamID - 3110000000000000000).ToString();
             //mListObjectItems.FirstOrDefault(s => s.ObjType == 3 && s.ObjParentID == "102" && s.ObjID == "10200" + code);
             ObjectItem objItem = new ObjectItem();
             objItem.ObjID       = string.Format("10200{0}", code);
             objItem.ObjParentID = "102";
             objItem.ObjType     = 3;
             objItem.ItemID      = string.Format("3108010200{0}", code);
             //if (objItem == null) { return; }
             objItem.Data = SPInfo;
             //objItem.Name = SPInfo.StatisticalParamName;
             //objItem.Description = SPInfo.StatisticalParamName;
             objItem.Name        = CurrentApp.GetLanguageInfo(string.Format("FO{0}", objItem.ItemID), SPInfo.StatisticalParamName);
             objItem.Description = CurrentApp.GetLanguageInfo(string.Format("3108D{0}", objItem.ItemID), SPInfo.StatisticalParamName);
             mListObjectItems.Add(objItem);
             if (SPInfo != null)
             {
                 mListStatisticalParam.Add(SPInfo);
             }
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
 private void LoadAddedCombinedParamItems()
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3108Codes.GetAddedCombinedParamItems;
         webRequest.Session = CurrentApp.Session;
         //webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
         Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
         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. WebReturn ListData is null"));
             return;
         }
         mListAddedParamsItems.Clear();
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             OperationReturn optReturn = XMLHelper.DeserializeObject <StatisticalParamItem>(webReturn.ListData[i]);
             if (!optReturn.Result)
             {
                 ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return;
             }
             StatisticalParamItem item = optReturn.Data as StatisticalParamItem;
             if (item == null)
             {
                 ShowException(string.Format("Fail. StatisticalParamItem is null"));
                 return;
             }
             if (mListAllCombinedParamItem.Count(c => c.StatisticalParamItemID == item.StatisticalParamItemID.ToString()) > 0)
             {
                 CombinedParamItemModel itemItem = new CombinedParamItemModel(item, CurrentApp);
                 mListAddedParamsItems.Add(itemItem);
             }
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 9
0
        //将界面上的值存入数据库,在这里也就是将mListStatisticalParamItemDetails_里的内容存入数据库
        private OperationReturn SaveValueToDB()
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            if (mListStatisticalParamItemDetails_ == null)
            {
                return(optReturn);
            }
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S3108Codes.SaveParamItemValue;
                for (int i = 0; i < mListStatisticalParamItemDetails_.Count; i++)
                {
                    optReturn = XMLHelper.SeriallizeObject(mListStatisticalParamItemDetails_[i]);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    webRequest.ListData.Add(optReturn.Data.ToString());
                }
                Service31081Client client = new Service31081Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(
                        CurrentApp.Session.AppServerInfo,
                        "Service31081"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = webReturn.Code;
                    optReturn.Message = webReturn.Message;
                    return(optReturn);
                }
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
            }
            return(optReturn);
        }
Esempio n. 10
0
 private void InitListABCD()
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3108Codes.GetABCDList;
         webRequest.Session = CurrentApp.Session;
         webRequest.ListData.Add("1");
         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("InitListABCD Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             OperationReturn optReturn = XMLHelper.DeserializeObject <StatisticParam>(webReturn.ListData[i]);
             if (!optReturn.Result)
             {
                 ShowException(string.Format("InitListABCD Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return;
             }
             StatisticParam StatisticP = optReturn.Data as StatisticParam;
             string         Name       = StatisticP.StatisticalParamID.ToString();
             Name = Name.Substring(Name.Length - 1);
             StatisticP.StatisticalParamName = CurrentApp.GetLanguageInfo(string.Format("FO3108010200{0}", Name), StatisticP.StatisticalParamName);
             StatisticP.Description          = CurrentApp.GetLanguageInfo(string.Format("FO3108010200{0}", Name), StatisticP.StatisticalParamName);
             if (StatisticP != null)
             {
                 Statistic = new StatisticParamModel(StatisticP);
                 //ListABCD.Add(Statistic);
                 Dispatcher.Invoke(new Action(() => { ListABCD.Add(Statistic); }));
             }
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 11
0
 private void InitListABCDItem()
 {
     if (OperationCode.Length < 19)
     {
         return;
     }
     ListABCDItems.Clear();
     //mListABCDItems.Clear();
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3108Codes.GetABCDItemList;
         webRequest.Session = CurrentApp.Session;
         webRequest.ListData.Add(OperationCode);
         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("InitListABCDItem Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             OperationReturn optReturn = XMLHelper.DeserializeObject <StatisticalParamItem>(webReturn.ListData[i]);
             if (!optReturn.Result)
             {
                 ShowException(string.Format("InitControledUsers Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return;
             }
             StatisticalParamItem StatisticP = optReturn.Data as StatisticalParamItem;
             StatisticP.StatisticalParamItemName = CurrentApp.GetLanguageInfo(string.Format("3108A{0}", StatisticP.StatisticalParamItemID), StatisticP.StatisticalParamItemName);
             StatisticP.Description = CurrentApp.GetLanguageInfo(string.Format("3108A{0}", StatisticP.StatisticalParamItemID), StatisticP.StatisticalParamItemName);
             ListABCDItems.Add(StatisticP);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 12
0
        //void LBStatistical_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    int num = this.LBStatistical.SelectedIndex;
        //    if (num == 0) { return; }
        //    StatisticalParam SP = this.LBStatistical.SelectedItem as StatisticalParam;
        //    OparetionCode = SP.StatisticalParamID.ToString();
        //}

        private void InitStatistical()
        {
            try
            {
                ListOrgStatistic.Clear();
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S3108Codes.GetABCDList;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add("1");
                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("InitListABCD Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <StatisticParam>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("InitListABCD Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    StatisticParam StatisticP = optReturn.Data as StatisticParam;
                    if (StatisticP != null)
                    {
                        ListOrgStatistic.Add(StatisticP);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Esempio n. 13
0
        private bool SaveParam(List <QualityParam> ListQP)
        {
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S3108Codes.SaveQualityParam;
                webRequest.Session = CurrentApp.Session;

                for (int i = 0; i < ListQP.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.SeriallizeObject <QualityParam>(ListQP[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return(false);
                    }
                    webRequest.ListData.Add(optReturn.Data.ToString());
                }

                Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
                //Service31061Client client = new Service31061Client();
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));

                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                ShowException(ex.ToString());

                return(false);
            }
        }
Esempio n. 14
0
 //这个参数大项是否分配到了技能组如果分配到了技能组或者机构 不过要在生效时间之内的才算有效  现在暂时不考虑生效时间
 private void IsDistributeOrgSkg()
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3108Codes.IsDistributeOrgSkg;
         webRequest.Session = CurrentApp.Session;
         webRequest.ListData.Add(StatisticalParam.StatisticalParamID.ToString());
         Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                            WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         string item = webReturn.Data as string;
         if (item == "1")
         {
             IsEdit.IsChecked            = true;
             DesignAndSaveIsEnabled      = true;
             StatisticDurition.IsEnabled = true;
         }
         if (item == "0")
         {
             IsEdit.IsChecked            = false;
             DesignAndSaveIsEnabled      = false;
             StatisticDurition.IsEnabled = false;
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 15
0
        //加载该用户3106的权限3108
        private void InitParam()
        {
            try
            {
                WebRequest webRequest = new WebRequest();

                webRequest.Code    = (int)S3108Codes.GetAuthorityParam;
                webRequest.Session = CurrentApp.Session;
                Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("InitParam:WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    //OperationReturn optReturn = XMLHelper.DeserializeObject<OperationInfo>(webReturn.ListData[i]);
                    //if (!optReturn.Result)
                    //{
                    //    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    //    return;
                    //}
                    //OperationInfo SPInfo = optReturn.Data as OperationInfo;
                    //string Code = SPInfo.ID.ToString();
                    string Code = webReturn.ListData[i];
                    if (Code.Length > 4)
                    {
                        ObjectItem item = new ObjectItem();
                        //Code = webReturn.ListData[i];
                        item.ItemID      = Code;
                        item.Name        = CurrentApp.GetLanguageInfo(string.Format("FO{0}", Code), Code);
                        item.Description = CurrentApp.GetLanguageInfo(string.Format("3108D{0}", Code), Code);
                        Code             = Code.Substring(4);
                        item.ObjID       = Code.Substring(1);
                        switch (Code.Count())
                        {
                        case 2:
                            item.ObjType     = 1;
                            item.ObjParentID = "0";
                            item.Data        = item;
                            break;

                        case 4:
                            item.ObjType     = 2;
                            item.ObjParentID = Code.Substring(1, 1);
                            item.Data        = item;
                            break;

                        case 7:
                            item.ObjType     = 3;
                            item.ObjParentID = Code.Substring(1, 3);
                            QualityParam tempQP = ListQP.Find(p => p.ParentTreeID == item.ItemID);
                            item.Data = tempQP;
                            break;

                        default:
                            break;
                        }
                        mListObjectItems.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
        //根据放入的统计参数子项来给其赋初始值[增加值的记录]或者删除那条记录,对T_31_044表进行的操作
        private OperationReturn ModifyValue()
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                //如果没有加入到的,或者已经从可组合参数大项里面移除的,那么就对T_31_044表进行删除操作
                if (mListAvaliableParamItems != null)
                {
                    for (int i = 0; i < mListAvaliableParamItems.Count; i++)
                    {
                        CombinedParamItemModel temp       = mListAvaliableParamItems[i];
                        WebRequest             webRequest = new WebRequest();
                        webRequest.Session = CurrentApp.Session;
                        webRequest.Code    = (int)S3108Codes.ModifyCombinedParamItems;
                        //此子项表示已经移除了参数大项,要对T_31_044里面的相应的记录做删除操作
                        webRequest.ListData.Add("Delete");
                        webRequest.ListData.Add(temp.ID.ToString());
                        webRequest.ListData.Add(temp.StatisticalParamItemID);
                        Service31081Client client = new Service31081Client(
                            WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                            WebHelper.CreateEndpointAddress(
                                CurrentApp.Session.AppServerInfo,
                                "Service31081"));
                        WebReturn webReturn = client.DoOperation(webRequest);
                        client.Close();
                        if (!webReturn.Result)
                        {
                            optReturn.Result  = false;
                            optReturn.Code    = webReturn.Code;
                            optReturn.Message = webReturn.Message;
                            return(optReturn);
                        }
                    }
                }
                //如果已经加入到了可组合的参数大项里面,那么就在T_31_044表里面增加一个记录,并且初始值(C004)为空
                if (mListAddedParamsItems != null)
                {
                    for (int i = 0; i < mListAddedParamsItems.Count; i++)
                    {
                        CombinedParamItemModel temp       = mListAddedParamsItems[i];
                        WebRequest             webRequest = new WebRequest();
                        webRequest.Session = CurrentApp.Session;
                        webRequest.Code    = (int)S3108Codes.ModifyCombinedParamItems;
                        //此子项表示已经添加到参数大项里,要对T_31_044里增加相应的记录
                        webRequest.ListData.Add("Add");
                        webRequest.ListData.Add(temp.ID.ToString());
                        webRequest.ListData.Add(temp.StatisticalParamItemID);
                        Service31081Client client = new Service31081Client(
                            WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                            WebHelper.CreateEndpointAddress(
                                CurrentApp.Session.AppServerInfo,
                                "Service31081"));
                        WebReturn webReturn = client.DoOperation(webRequest);
                        client.Close();
                        if (!webReturn.Result)
                        {
                            optReturn.Result  = false;
                            optReturn.Code    = webReturn.Code;
                            optReturn.Message = webReturn.Message;
                            ShowException(optReturn.Message);
                            return(optReturn);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
                ShowException(ex.Message);
            }
            return(optReturn);
        }
        public OperationReturn SaveConfig()
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                List <StatisticalParamItem> listItems = new List <StatisticalParamItem>();
                for (int i = 0; i < mListTabItems.Count; i++)
                {
                    CombinedParamTabItem tabItem = mListTabItems[i];
                    for (int j = 0; j < tabItem.Items.Count; j++)
                    {
                        CombinedParamItemModel item = tabItem.Items[j];
                        //这个是将我要的东西给到公共类StatisticalParamItem里面  赋好值
                        item.Apply();
                        listItems.Add(item.ParamItem);
                    }
                }
                if (listItems.Count > 0)
                {
                    WebRequest webRequest = new WebRequest();
                    webRequest.Session = CurrentApp.Session;
                    webRequest.Code    = (int)S3108Codes.SaveAddedParamItemsInfos;
                    int count = listItems.Count;
                    //webRequest.ListData.Add(count.ToString());
                    //webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
                    for (int i = 0; i < count; i++)
                    {
                        optReturn = XMLHelper.SeriallizeObject(listItems[i]);
                        if (!optReturn.Result)
                        {
                            return(optReturn);
                        }
                        webRequest.ListData.Add(optReturn.Data.ToString());
                    }
                    Service31081Client client = new Service31081Client(
                        WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                        WebHelper.CreateEndpointAddress(
                            CurrentApp.Session.AppServerInfo,
                            "Service31081"));
                    WebReturn webReturn = client.DoOperation(webRequest);
                    client.Close();
                    if (!webReturn.Result)
                    {
                        optReturn.Result  = false;
                        optReturn.Code    = webReturn.Code;
                        optReturn.Message = webReturn.Message;
                        return(optReturn);
                    }
                }
                //那些没有放入Tab里的也需修改里面的字段保存(有的做了删除参数的 也是需要将其存入数据库的)
                if (mListAvaliableParamItems.Count > 0)
                {
                    WebRequest webRequest = new WebRequest();
                    webRequest.Session = CurrentApp.Session;
                    webRequest.Code    = (int)S3108Codes.SaveAddedParamItemsInfos;
                    int count = mListAvaliableParamItems.Count;
                    //webRequest.ListData.Add(count.ToString());
                    //webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
                    for (int i = 0; i < count; i++)
                    {
                        optReturn = XMLHelper.SeriallizeObject(mListAvaliableParamItems[i].ParamItem);
                        if (!optReturn.Result)
                        {
                            return(optReturn);
                        }
                        webRequest.ListData.Add(optReturn.Data.ToString());
                    }
                    Service31081Client client = new Service31081Client(
                        WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                        WebHelper.CreateEndpointAddress(
                            CurrentApp.Session.AppServerInfo,
                            "Service31081"));
                    WebReturn webReturn = client.DoOperation(webRequest);
                    client.Close();
                    if (!webReturn.Result)
                    {
                        optReturn.Result  = false;
                        optReturn.Code    = webReturn.Code;
                        optReturn.Message = webReturn.Message;
                        return(optReturn);
                    }
                }
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
            }
            return(optReturn);
        }
Esempio n. 18
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());
            }
        }
Esempio n. 19
0
 private void InitStatisticConfig()
 {
     try
     {
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3108Codes.GetABCDInfo;
         webRequest.Session = CurrentApp.Session;
         webRequest.ListData.Add(OrgItem.ItemID.ToString());
         //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("InitStatisticConfig Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             OperationReturn optReturn = XMLHelper.DeserializeObject <StatisticParam>(webReturn.ListData[i]);
             if (!optReturn.Result)
             {
                 ShowException(string.Format("InitStatisticConfig Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return;
             }
             StatisticParam SP = optReturn.Data as StatisticParam;
             int            index;
             for (index = 0; index < ListABCD.Count(); index++)
             {
                 if (ListABCD[index].StatisticalParamID == SP.StatisticalParamID)
                 {
                     ListABCD[index].StatisticKey   = SP.StatisticKey;
                     ListABCD[index].OrgID          = SP.OrgID;
                     ListABCD[index].StatisticType  = SP.StatisticType;
                     ListABCD[index].IsApplyAll     = SP.IsApplyAll;
                     ListABCD[index].StartTime      = Convert.ToDateTime(SP.StartTime);
                     ListABCD[index].EndTime        = Convert.ToDateTime(SP.EndTime);
                     ListABCD[index].RowNum         = SP.RowNum;
                     ListABCD[index].CycleTime      = SP.CycleTime;
                     ListABCD[index].CycleTimeParam = SP.CycleTimeParam;
                     ListABCD[index].UpdateTime     = SP.UpdateTime;
                     ListABCD[index].UpdateUnit     = SP.UpdateUnit;
                     break;
                 }
             }
             //Statistic.StatisticKey = SP.StatisticKey;
             //Statistic.OrgID = SP.OrgID;
             //Statistic.StatisticType = SP.StatisticType;
             //Statistic.IsApplyAll = SP.IsApplyAll;
             //Statistic.StartTime = SP.StartTime;
             //Statistic.EndTime = SP.EndTime;
             //Statistic.RowNum = SP.RowNum;
             //Statistic.CycleTime = SP.CycleTime;
             //Statistic.CycleTimeParam = SP.CycleTimeParam;
             //Statistic.UpdateTime = SP.UpdateTime;
             //Statistic.UpdateUnit = SP.UpdateUnit;
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 20
0
 public void InitListBox()
 {
     try
     {
         ListStatistical.Clear();
         if (ObjItem == null)
         {
             return;
         }
         InitLBFirstItem();
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S3108Codes.GetABCDInfo;
         webRequest.Session = CurrentApp.Session;
         webRequest.ListData.Add(ObjItem.ItemID.ToString());
         //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("InitStatisticConfig Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
             return;
         }
         //if (webReturn.ListData.Count == 0)
         //{
         //    foreach (StatisticParam SP in ListOrgStatistic)
         //    {
         //        ListStatistical.Add(SP);
         //    }
         //}
         //else
         //{
         for (int i = 0; i < webReturn.ListData.Count; i++)
         {
             OperationReturn optReturn = XMLHelper.DeserializeObject <StatisticParam>(webReturn.ListData[i]);
             if (!optReturn.Result)
             {
                 ShowException(string.Format("InitStatisticConfig Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return;
             }
             StatisticParam SP = optReturn.Data as StatisticParam;
             if (SP.StatisticalParamID == 3110000000000000008)
             {
                 SP.TableType = 2;
             }
             else
             {
                 SP.TableType = 1;
             }
             string spID = SP.StatisticalParamID.ToString();
             spID = spID.Substring(spID.Length - 1);
             SP.StatisticalParamName = CurrentApp.GetLanguageInfo(string.Format("FO3108010200{0}", spID), SP.StatisticalParamID.ToString());
             ListStatistical.Add(new StatisticParamModel(SP));
         }
     }
     //}
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Esempio n. 21
0
        private void InitQualityParam()
        {
            ListQP.Clear();
            try
            {
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)S3108Codes.GetQualityParam;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add("31");
                webRequest.ListData.Add("0");
                webRequest.ListData.Add("310101");
                Service31081Client client = new Service31081Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service31081"));
                //Service31061Client client = new Service31061Client();
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("InitQualityParam:WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message));
                    return;
                }
                List <QualityParam> listGlobalParam = new List <QualityParam>();
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <QualityParam>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    QualityParam GlobalParamInfo = optReturn.Data as QualityParam;
                    //将获取的数据一条条加入ListQP,并且获取name和description
                    string LanguageCode = string.Empty; string GroupCode = string.Empty;
                    GetGroupID(GlobalParamInfo.GroupID.ToString().Substring(4), out GroupCode);
                    GetParamID(GlobalParamInfo.GroupID.ToString().Substring(4), out LanguageCode);

                    LanguageCode               += GlobalParamInfo.SortID.ToString();
                    GlobalParamInfo.Name        = CurrentApp.GetLanguageInfo(string.Format("3108{0}", LanguageCode), "");
                    GlobalParamInfo.Description = CurrentApp.GetLanguageInfo(string.Format("3108D{0}", LanguageCode), "");
                    switch (GlobalParamInfo.GroupID - 310100)
                    {
                    case 1:
                        GlobalParamInfo.ParentTreeID = "31080101001";
                        break;

                    case 2:
                        GlobalParamInfo.ParentTreeID = "31080101002";
                        break;

                    case 3:
                        GlobalParamInfo.ParentTreeID = "31080101003";
                        break;

                    case 4:
                        GlobalParamInfo.ParentTreeID = "31080101004";
                        break;
                    }
                    ListQP.Add(GlobalParamInfo);
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }