1 回答
TA贡献1807条经验 获得超9个赞
我想您只需setValue2getValue种方法即可:
public class Levels {
private string LevelWeek {
get;
set;
}
private string LevelHours {
get;
set;
}
public int Start {
get;
set;
}
public int Length {
get;
set;
}
public string Name {
get;
set;
}
public string Address {
get;
set;
}
public string LevelType {
get;
set;
}
public void setValue() {
if (string.IsNullOrEmpty(LevelType) {
this.LevelWeek = "Not set";
this.LevelHours = "Not set";
} else {
if (LevelType.Equals("Junior") {
this.LevelWeek = LevelType;
} else {
this.LevelHours = "Senior";
}
}
}
public string getLevelWeek() {
return this.LevelWeek;
}
public string getLevelHours() {
return this.LevelHours;
}
}
}
}
声明对象时:
var level = new Levels {
Start = Convert.ToInt32(Request["start"]),
Length = Convert.ToInt32(Request["length"]),
Name = Request[("columns[3][search][value]")],
Address = Request[("columns[4][search][value]")],
LevelType = Request[("columns[6][search][value]")]
}
// set value to LevelWeek / LevelHours
level.setValue();
// In AssignDetails function : get the value of LevelWeek and LevelHours:
var levelweek = level.getLevelWeek();
var levelhours = level.getLevelHours();
- 1 回答
- 0 关注
- 119 浏览
添加回答
举报