public WrongModel InitWrongModel(string message) { WrongModel model = new WrongModel(); model.Message = message; return(model); }
public WrongModel InitWrongModel() { WrongModel model = new WrongModel(); model.Message = "数据列的格式有误!"; return(model); }
public void SetObjectProperty(List <string> listValue) { List <WrongModel> list = new List <WrongModel>(); List <AssetViewModel> list2 = new List <AssetViewModel>(); WrongModel item = new WrongModel(); AssetViewModel model2 = new AssetViewModel(); this.totalCount = listValue.Count - 1; for (int i = 1; i < listValue.Count; i++) { string[] array = listValue[i].Split(new char[] { ',' }); int length = array.Length; if (length.Equals(12)) { if (string.IsNullOrEmpty(array[deptIndex])) { model2 = this.InitAssetViewModel(array); model2.NoIndex = i; model2.Index = ++this.rightCount; list2.Add(model2); } else { string name = array[deptIndex]; string unitCode = this.GetUnitCode(name); if (string.IsNullOrEmpty(unitCode)) { item = this.InitWrongModel("“使用部门”的格式有错误,请注意使用->分割。"); item.NoIndex = i; item.Index = ++this.wrongCount; list.Add(item); } else { array[deptIndex] = unitCode; model2 = this.InitAssetViewModel(array); model2.DeptName = name; model2.NoIndex = i; model2.Index = ++this.rightCount; list2.Add(model2); } } } else { item = this.InitWrongModel(); item.Index = ++this.wrongCount; item.NoIndex = i; list.Add(item); } } this.ListUserfulModel = list2; this.ListWrongModel = list; }