bool ValidateData() { if (this.tbModelName_.Text.Trim() == "") { this.errorProvider.SetError(this.tbModelName_, Properties.Resources.ST_PROMPT_INVALID_INPUT); return(false); } if (this.tbStringlabel_.Text.Trim() == "") { this.errorProvider.SetError(this.tbStringlabel_, Properties.Resources.ST_PROMPT_INVALID_INPUT); return(false); } if (this.IsEditMode == false) { string strValignFilFilePath = Path.Combine(this.app.AppDataPath, "VALIGN.FIL"); CValignInfo[] infoarr = CValignUtil.ReadValigns(strValignFilFilePath); foreach (CValignInfo info in infoarr) { if (info.ModelName.Trim().ToLower() == this.tbModelName_.Text.Trim().ToLower() && info.StringLabel.Trim().ToLower() == this.tbStringlabel_.Text.Trim().ToLower()) { this.errorProvider.SetError(this.tbStringlabel_ , "Model Name and String Level already exists\nPlease specify unique Model Name and String Level"); this.tbStringlabel_.Focus(); return(false); } } } return(true); }
public static void SaveValign(string strWorkingDirPath) { StreamReader readerSrc = new StreamReader(Path.Combine(strWorkingDirPath, "VALIGN.TMP")); List <CValignFilData> listTempValign = new List <CValignFilData>(); while (readerSrc.EndOfStream == false) { string strlineSrc = readerSrc.ReadLine(); CValignFilData filDataTemp = CValignFilData.Parse(strlineSrc); if (filDataTemp != null) { listTempValign.Add(filDataTemp); } } readerSrc.Close(); //If any data present in temp file if (listTempValign.Count > 0) { string strValignFilePath = Path.Combine(strWorkingDirPath, "VALIGN.FIL"); CValignInfo[] infoarr = CValignUtil.ReadValigns(strValignFilePath); StreamWriter writerDesti = new StreamWriter(strValignFilePath, false); foreach (CValignInfo info in infoarr) { foreach (CValignFilData filData in info.DataList) { if (filData.modnam != listTempValign[0].modnam || filData.stglbl != listTempValign[0].stglbl) { writerDesti.WriteLine(filData.ToString()); } } } //Now write the data from temp file foreach (CValignFilData filData in listTempValign) { writerDesti.WriteLine(filData.ToString()); } writerDesti.Close(); } }
void PopulateSelectionTree() { TreeNode nodeRoot = this.treeViewModels_.Nodes[0]; nodeRoot.Tag = null; nodeRoot.Expand(); string strValignFilPath = Path.Combine(this.app.AppDataPath, "VALIGN.FIL"); CValignInfo[] infoarr = CValignUtil.ReadValigns(strValignFilPath); foreach (CValignInfo info in infoarr) { TreeNode nodemodel = this.FindModelNode(info.ModelName); if (nodemodel == null) { nodemodel = nodeRoot.Nodes.Add(info.ModelName); } TreeNode nodeLabel = nodemodel.Nodes.Add(info.StringLabel); nodeLabel.Tag = info; } }