public part_mismatch(component component_edif, component component_bom, string error_msg) { error = error_msg; edif = component_edif; bom = component_bom; assign_members_bom(); }
public part_mismatch(component component, DataRow row, string error_msg) { edif = component; partmast = row; error = error_msg; assign_members(); }
} //if there is a false then adds to error_list and fills the data. private void build_error_list(int[] compare, component edif, component bom) //overload for bom { string[] errors = new string[2] { "Instance ", "Instance Names " }; for (int i = 0; i < compare.Length; i++) { if (compare[i] != 1) { string error = errors[i] + generate_error(compare[i]); part_mismatch mismatch = new part_mismatch(edif, bom, error); error_list.Add(mismatch); } //if its wrong } //go through compare list } //if there is a false then adds to error_list and fills the data.
} //goal of this is to mark cascaded instance errors as warnings private void build_error_list(int[] compare, component edif, DataRow partmast) //overload for pcmrp { string[] errors = new string[6] { "Aux ", "Footprint ", "Value ", "Package ", "Temperature ", "ModelNo " }; for (int i = 0; i < compare.Length; i++) { if (compare[i] != 1) { string error = errors[i] + generate_error(compare[i]); part_mismatch mismatch = new part_mismatch(edif, partmast, error); error_list.Add(mismatch); } //if its wrong } //go through compare list } //if there is a false then adds to error_list and fills the data.
} //read EDIF file into a string list private List <component> filter_edif_file(List <string> edif_file) { List <component> components = new List <component>(); for (int i = 0; i < edif_file.Count; i++) { string line = edif_file[i]; if (line.Contains("(Instance ")) { string raw_text = string.Empty; raw_text += line; //add in teh instance name line -> but wait! causes fail in raw text match for (int j = 0; j < 25; j++) { line = edif_file[i + j]; if (valid_line(line)) { raw_text += line; } } if (!raw_text.Contains("DNI")) //dont save if its DNI { component addition = new component(raw_text); //auto populate the members if (addition.type != '\0') //if valid component { components.Add(addition); //adding it to the list } } /* * var instance = return_object(raw_text); * * if (instance is component) * { * components = add_component(components, (component)instance); //if reistor or capacitor * } */ //this is if we want to differentiate component objects, decided to use the same } //save next 25 lines if so, then save the object } return(components); }
private List <component> build_bom_list(DataTable bom) { List <component> bom_list = new List <component>(); foreach (DataRow row in bom.Rows) { component new_component = new component(row); new_component.assign_members_bom(); //string temp = new_component.instance_names[0]; //first part name from each row -> to make next lien more readable //if ((temp.StartsWith("R") || temp.StartsWith("C")) && Char.IsDigit(temp[1])) //if starts with C or R, and has a number after that bom_list.Add(new_component); } //loop through all entries in db if (bom_list.Count == 0) { MessageBox.Show("Nothing found for this BOM #, are you sure it is correct?"); } return(bom_list); }