private void BindDropDownListPhases() { try { Dictionary <string, string> phases = new PmsCommonEnum().GetEnumValueAndDesc(typeof(PmsCommonEnum.PlanPhase)); if (phases.Keys.Contains("PES阶段")) { phases.Remove("PES阶段"); } if (phases.Keys.Contains("上线实施阶段")) { phases.Remove("上线实施阶段"); } this.DropDownListPhases.DataSource = phases; this.DropDownListPhases.DataTextField = "Key"; this.DropDownListPhases.DataValueField = "Value"; this.DropDownListPhases.DataBind(); this.DropDownListPhases.Items.Insert(0, new ListItem()); this.DropDownListPhases.Items[0].Text = ""; this.DropDownListPhases.Items[0].Value = ""; this.DropDownListPhases.SelectedIndex = 0; } catch { ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Bind TaskPhases failure');", true); this.DropDownListPhases.Focus(); } }
private bool GetTmpSdpDetail(XmlNode node, ref TmpSdpImportdetail tmpSdpDetail, ref bool pass, ref List <string> list) { foreach (XmlNode subNode in node.ChildNodes) { if (subNode.Name == "UID") { string taskId = subNode.InnerText; if (taskId == "0") { pass = true; break; } if (Assignments[taskId] != null) { string resourceId = Assignments[taskId].ToString(); if (resourceId.Contains(",")) { string[] resourceIds = resourceId.Split(','); string resource = ""; foreach (string id in resourceIds) { if (resource != "") { resource += ","; } resource += Resources[id].ToString(); } tmpSdpDetail.Resource = resource; } else { tmpSdpDetail.Resource = Resources[Assignments[taskId]].ToString(); } } else { Msgbox("Resource names of all task can not be empty!"); return(false); } } if (subNode.Name == "ID") { //如果没有任务名称跳过不保存 if (subNode.NextSibling.Name != "Name") { pass = true; break; } } if (subNode.Name == "WBS") { string wbs = subNode.InnerText; tmpSdpDetail.Wbs = wbs; if (wbs == "0") { pass = true; break; } if (wbs.Contains('.')) { tmpSdpDetail.Parentno = wbs.Remove(wbs.LastIndexOf(".")); } else { tmpSdpDetail.Parentno = ""; } } if (subNode.Name == "Name") { tmpSdpDetail.TaskName = subNode.InnerText; } if (subNode.Name == "Start") { tmpSdpDetail.Planstartday = DateTime.Parse(subNode.InnerText); } if (subNode.Name == "Finish") { tmpSdpDetail.Planendday = DateTime.Parse(subNode.InnerText); } if (subNode.Name == "Duration") { string planCost = subNode.InnerText; planCost = planCost.Replace("PT", "").Trim(); planCost = planCost.Replace("H0M0S", "").Trim(); tmpSdpDetail.Plancost = float.Parse(planCost); } if (subNode.Name == "ExtendedAttribute") { List <string> typeInfo = GetTaskTypeTable(subNode); string type = Types[typeInfo[0]].ToString(); list.Remove(type); switch (type) { case "Role": tmpSdpDetail.Role = typeInfo[1].ToString(); break; case "TaskComplexity": tmpSdpDetail.TaskComplexity = (int)Enum.Parse(typeof(PmsCommonEnum.TaskComplexity), typeInfo[1]); break; case "Phase": Dictionary <string, string> phases = new PmsCommonEnum().GetEnumValueAndDesc(typeof(PmsCommonEnum.PlanPhase)); tmpSdpDetail.Phase = int.Parse(phases[typeInfo[1]]).ToString(); break; case "TaskType1": int taskTypeValue = -1; if (!CheckTaskType(tmpSdpDetail.Phase, typeInfo[1], ref taskTypeValue)) { Msgbox("TaskName-(" + tmpSdpDetail.TaskName + "):Pahse 与 TaskType 不匹配!"); return(false); } else { tmpSdpDetail.TaskType = taskTypeValue; } break; case "OperationType": Dictionary <string, string> OperationTypes = new PmsCommonEnum().GetEnumValueAndDesc(typeof(PmsCommonEnum.OperationType)); tmpSdpDetail.OperationType = int.Parse(OperationTypes[typeInfo[1]]); break; case "ProgramLanguage": Dictionary <string, string> ProgramLanguages = new PmsCommonEnum().GetEnumValueAndDesc(typeof(PmsCommonEnum.ProgramLanguage)); tmpSdpDetail.ProgramLanguage = int.Parse(ProgramLanguages[typeInfo[1]]); break; case "FunctionType": tmpSdpDetail.FunctionType = (int)Enum.Parse(typeof(PmsCommonEnum.FunctionType), typeInfo[1]); break; } } } return(true); }