private void DeleteKpiMapObjectInfo() { try { WebRequest webRequest = new WebRequest(); webRequest.Code = (int)S4601Codes.DeleteKpiMapObjectInfo; webRequest.Session = CurrentApp.Session; webRequest.ListData.Add(mCurrentKpiMapObjectInfoItem.KpiMapObjectInfo.KpiMappingID);//对象ID 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; } else { mListKpiMapObjectInfoItem.Remove(mCurrentKpiMapObjectInfoItem); ShowInformation(CurrentApp.GetLanguageInfo("4601TIP00001", "chenggong")); } } catch (Exception ex) { ShowException(ex.Message); } }
private void InitControlSkillGroup(ObjectItem parentItem, string parentID) { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4601Codes.GetControlSkillGroupInfoList; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add("-1"); //Service46011Client client = new Service46011Client(); Service46011Client client = new Service46011Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service46011")); //WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } List <SkillGroupInfo> listSkillGroupInfo = new List <SkillGroupInfo>(); for (int i = 0; i < webReturn.ListData.Count; i++) { OperationReturn optReturn = XMLHelper.DeserializeObject <SkillGroupInfo>(webReturn.ListData[i]); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } SkillGroupInfo columnInfo = optReturn.Data as SkillGroupInfo; if (columnInfo != null) { listSkillGroupInfo.Add(columnInfo); } } for (int i = 0; i < listSkillGroupInfo.Count; i++) { SkillGroupInfo strInfo = listSkillGroupInfo[i]; ObjectItem item = new ObjectItem(); item.ObjType = ConstValue.RESOURCE_TECHGROUP; item.Name = strInfo.SkillGroupName; item.Description = strInfo.SkillGroupCode; item.ObjID = Convert.ToInt64(strInfo.SkillGroupID); item.Icon = "Images/SkillGroup.ico"; item.ParantID = strInfo.SkillGroupID; mListAllObjects.Add(item); InitControlObjectItemInSkillGroup(item, item.ObjID.ToString()); AddChildObject(parentItem, item); } } catch (Exception ex) { ShowException(ex.Message); } }
private void InitControlUsers(ObjectItem parentItem, string parentID) { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4601Codes.GetControlUserInfoList; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add(parentID); //Service46011Client client = new Service46011Client(); Service46011Client client = new Service46011Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service46011")); WebHelper.SetServiceClient(client); 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]; ObjectItem item = new ObjectItem(); item.ObjType = ConstValue.RESOURCE_USER; item.ObjID = Convert.ToInt64(strID); //用户全名 在界面上显示的 item.Name = strFullName; //用户账号 不在界面上显示的 item.FullName = strName; item.Data = strInfo; item.Description = string.Format("{0}({1})", strFullName, strName); item.Icon = "Images/user.ico"; item.ParantID = parentID; mListAllObjects.Add(item); AddChildObject(parentItem, item); } } catch (Exception ex) { ShowException(ex.Message); } }
private void AlterState() { try { WebRequest webRequest = new WebRequest(); webRequest.Code = (int)S4601Codes.AlterState; webRequest.Session = CurrentApp.Session; webRequest.ListData.Add(mCurrentKpiInfoItem.KpiInfo.KpiID);//对象ID webRequest.ListData.Add(mCurrentKpiInfoItem.Active); 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; } else { //变更成功之后要刷新下 //LoadKpiDetailInfo(); if (mCurrentKpiInfoItem.Active == "0") { mCurrentKpiInfoItem.Active = "1"; mCurrentKpiInfoItem.StrActive = CurrentApp.GetLanguageInfo(string.Format("4601IsActive{0}", mCurrentKpiInfoItem.Active), mCurrentKpiInfoItem.Active); } else { mCurrentKpiInfoItem.Active = "0"; mCurrentKpiInfoItem.StrActive = CurrentApp.GetLanguageInfo(string.Format("4601IsActive{0}", mCurrentKpiInfoItem.Active), mCurrentKpiInfoItem.Active); } //for (int i = 0; i < mListKpiInfoItems.Count; i++) //{ // if (mListKpiInfoItems[i].KpiInfo.KpiID == mCurrentKpiInfoItem.KpiInfo.KpiID) // { // mListKpiInfoItems[i].Active = mCurrentKpiInfoItem.Active; // mListKpiInfoItems[i].StrActive = mCurrentKpiInfoItem.StrActive; // } //} //MessageBox.Show("SUCCESS"); } } catch (Exception ex) { ShowException(ex.ToString()); } }
private bool SaveToDB() { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4601Codes.ModifyDefaultValue; OperationReturn optReturn = new OperationReturn(); optReturn = XMLHelper.SeriallizeObject(CurrentSelectItem.KpiInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return(false); } webRequest.ListData.Add(optReturn.Data.ToString()); //Service46011Client client = new Service46011Client(); Service46011Client client = new Service46011Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service46011")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return(false); } return(true); #region 写操作日志 //string strLog = string.Format("{0} {1} ", Utils.FormatOptLogString("COL3102001RecordReference"), RecordInfoItem.SerialID); //CurrentApp.WriteOperationLog(S3102Consts.OPT_MEMORECORD.ToString(), ConstValue.OPT_RESULT_SUCCESS, strLog); #endregion } catch (Exception ex) { ShowException(ex.Message); return(false); } }
//加载所有的KPI详细信息 private void LoadKpiDetailInfo() { try { WebRequest webRequest = new WebRequest(); webRequest.Code = (int)S4601Codes.GetAllKPIInfoLists; webRequest.Session = CurrentApp.Session; 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; } mListKpiInfoItems.Clear(); for (int i = 0; i < webReturn.ListData.Count; i++) { OperationReturn optReturn = XMLHelper.DeserializeObject <KpiInfo>(webReturn.ListData[i]); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } KpiInfo item = optReturn.Data as KpiInfo; if (item != null) { KpiInfoItem temp = new KpiInfoItem(item); temp.StrActive = CurrentApp.GetLanguageInfo(string.Format("4601IsActive{0}", temp.Active), temp.Active); temp.StrDescription = CurrentApp.GetLanguageInfo(string.Format("4601KPI{0}", temp.KpiInfo.KpiID), temp.Description); if (Regex.Matches(temp.UseType, @"1").Count > 0) { temp.StrUseType = string.Empty; if (temp.UseType.Substring(0, 1) == "1") { temp.StrUseType += CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", "1000000000"), "1000000000") + ","; } if (temp.UseType.Substring(1, 1) == "1") { temp.StrUseType += CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", "0100000000"), "0100000000") + ","; } if (temp.UseType.Substring(2, 1) == "1") { temp.StrUseType += CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", "0010000000"), "0010000000") + ","; } if (temp.UseType.Substring(3, 1) == "1") { temp.StrUseType += CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", "0001000000"), "0001000000") + ","; } if (temp.UseType.Substring(4, 1) == "1") { temp.StrUseType += CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", "0000100000"), "0001000000") + ","; } if (temp.UseType.Substring(5, 1) == "1") { temp.StrUseType += CurrentApp.GetLanguageInfo(string.Format("4601BPOBJ{0}", "0000010000"), "0001000000") + " "; } } if (Regex.Matches(temp.ApplyCycle, @"1").Count > 0) { temp.StrApplyCycle = string.Empty; if (temp.ApplyCycle.Substring(0, 1) == "1") { temp.StrApplyCycle += CurrentApp.GetLanguageInfo(string.Format("4601BP{0}", "1000000001"), "1000000001") + ","; } if (temp.ApplyCycle.Substring(1, 1) == "1") { temp.StrApplyCycle += CurrentApp.GetLanguageInfo(string.Format("4601BP{0}", "0100000001"), "0100000001") + ","; } if (temp.ApplyCycle.Substring(2, 1) == "1") { temp.StrApplyCycle += CurrentApp.GetLanguageInfo(string.Format("4601BP{0}", "0010000001"), "0010000001") + ","; } if (temp.ApplyCycle.Substring(3, 1) == "1") { temp.StrApplyCycle += CurrentApp.GetLanguageInfo(string.Format("4601BP{0}", "0001000001"), "0001000001") + ","; } if (temp.ApplyCycle.Substring(4, 1) == "1") { temp.StrApplyCycle += CurrentApp.GetLanguageInfo(string.Format("4601BP{0}", "0000100001"), "0000100001") + ","; } if (temp.ApplyCycle.Substring(5, 1) == "1") { temp.StrApplyCycle += CurrentApp.GetLanguageInfo(string.Format("4601BP{0}", "0000010001"), "0000010001") + ","; } if (temp.ApplyCycle.Substring(6, 1) == "1") { temp.StrApplyCycle += CurrentApp.GetLanguageInfo(string.Format("4601BP{0}", "0000001001"), "0000001001") + ","; } if (temp.ApplyCycle.Substring(7, 1) == "1") { temp.StrApplyCycle += CurrentApp.GetLanguageInfo(string.Format("4601BP{0}", "0000000101"), "0000000101") + ","; } if (temp.ApplyCycle.Substring(8, 1) == "1") { temp.StrApplyCycle += CurrentApp.GetLanguageInfo(string.Format("4601BP{0}", "0000000011"), "0000000011") + " "; } } mListKpiInfoItems.Add(temp); } } } catch (Exception ex) { ShowException(ex.Message); } }
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); } }
private void InitControlObjectItemInSkillGroup(ObjectItem parentItem, string parentID) { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4601Codes.GetControlObjectInfoListInSkillGroup; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add(parentID); webRequest.ListData.Add(GroupingWay); //Service46011Client client = new Service46011Client(); Service46011Client client = new Service46011Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service46011")); //WebHelper.SetServiceClient(client); 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); string strID = string.Empty; string strIP = string.Empty; string strName = string.Empty; string strFullName = string.Empty; ObjectItem item = new ObjectItem(); if (arrInfo.Length < 3) { continue; } if (arrInfo.Length == 4) { strID = arrInfo[0]; strIP = arrInfo[1]; strName = arrInfo[2]; strFullName = arrInfo[3]; item.ObjID = Convert.ToInt64(strID); item.FullName = strIP; item.Description = strFullName; item.Name = strName; item.ObjType = ConstValue.RESOURCE_EXTENSION; item.Icon = "Images/extension.ico"; } else { strID = arrInfo[0]; strName = arrInfo[1]; strFullName = arrInfo[2]; if (strID.IndexOf("103") == 0) { item.ObjType = ConstValue.RESOURCE_AGENT; item.ObjID = Convert.ToInt64(strID); item.Name = strName; item.Description = strFullName; item.Data = strInfo; item.Icon = "Images/agent.ico"; } else { item.ObjType = ConstValue.RESOURCE_REALEXT; item.ObjID = Convert.ToInt64(strID); item.Name = strName; item.Description = strFullName; item.Data = strInfo; item.Icon = "Images/RealExtension.ico"; } } item.ParantID = parentID; mListAllObjects.Add(item); AddChildObject(parentItem, item); } } catch (Exception ex) { ShowException(ex.Message); } }
private void InitControlOrgs(ObjectItem parentItem, string parentID) { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4601Codes.GetControlOrgInfoList; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add(parentID); //Service46011Client client = new Service46011Client(); Service46011Client client = new Service46011Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service46011")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("WSFail.\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 < 2) { continue; } string strID = arrInfo[0]; string strName = arrInfo[1]; ObjectItem item = new ObjectItem(); item.ObjType = ConstValue.RESOURCE_ORG; item.ObjID = Convert.ToInt64(strID); item.Name = strName; item.Data = strInfo; item.ParantID = strID; if (strID == ConstValue.ORG_ROOT.ToString()) { item.Icon = "Images/rootorg.ico"; } else { item.Icon = "Images/org.ico"; } mListAllObjects.Add(item); InitControlOrgs(item, strID); InitControlUsers(item, strID); if (GroupingWay.IndexOf("R") >= 0) { InitControlRealExtensions(item, strID); } if (GroupingWay.IndexOf("E") >= 0) { InitControlExtensions(item, strID); } if (GroupingWay.IndexOf("A") >= 0) { InitControlAgents(item, strID); } AddChildObject(parentItem, item); } } catch (Exception ex) { ShowException(ex.Message); } }