这是我大四上学期期末课程设计中所编写的物业客户管理信息系统的一个关于状态转换的类。这个类主要是负责对数据库查询到的数据中制定的一个字段的值进行转换,例如通过查询数据库得到某个字段的值为0,则通过这个状态转换类对这个值进行相应的转换,通常情况下,0预设的默认值为未审核,普通用户,未处理等、除此之外,该类中还包含了对用户姓名和编号ID之间的相互转换,例如通过一个ID可以查询到唯一一个与其对应的用户名,和通过一个用户姓名可以查询到一个与其对应的ID(通过用户名查询ID功能未完善,只能查询一个与其对应的用户姓名)。
以下是该类的代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
| using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; using System.Data.SqlClient; namespace WYMIS { class Zhuangtai_Class { SQL_Class SQLClass = new SQL_Class(); public string Zhufang(string num) { string zhuangtai = “0”; if(num == “0”) { zhuangtai = “未入住”; } else if(num == “1”) { zhuangtai = “已入住”; } else { zhuangtai = “空”; } return zhuangtai; } public string YezhuQuanxian(string num) { string quanxian = “0”; if(num == “0”) { quanxian = “未审核”; } else if(num == “1”) { quanxian = “已审核”; } else { quanxian = “已删除”; } return quanxian; } public string YuangongQuanxian(string num) { string quanxian = “0”; if(num == “0”) { quanxian = “普通员工”; } else if(num == “1”) { quanxian = “管理员”; } else if(num == “2”) { quanxian = “超级管理员”; } else { quanxian = “离岗员工”; } return quanxian; } public string Richang(string num) { string zhuangtai = “0”; if(num == “0”) { zhuangtai = “未完成”; } else { zhuangtai = “已完成”; } return zhuangtai; } public string Fuwu(string num) { string zhuangtai = “0”; if(num == “0”) { zhuangtai = “未处理”; } else if (num == “1”) { zhuangtai = “已受理”; } else { zhuangtai = “已完成”; } return zhuangtai; } public string Yewu(string num) { string zhuangtai = “0”; if(num == “1”) { zhuangtai = “日常事务”; } else if(num == “2”) { zhuangtai = “业主申请”; } else if(num == “3”) { zhuangtai = “收费信息”; } return zhuangtai; } public string Shoufei_leixing(string num) { string leixing = “0”; if(num == “0”) { leixing = “未缴费”; } else if(num == “1”) { leixing = “已缴费”; } return leixing; } public string KaifashangName(string num,bool isname) { string kaifashang; if (isname) { DataSet DSet = SQLClass.getDataSet(“select gongsi from kaifashang where id = ‘” + num + “‘”, “开发商信息表”); DataTable dt = DSet.Tables[“开发商信息表”]; if (dt.Rows.Count > 0) { kaifashang = dt.Rows[0][0].ToString(); } else { kaifashang = null; } } else { DataSet DSet = SQLClass.getDataSet(“select id from kaifashang where gongsi = ‘” + num + “‘”, “开发商信息表”); DataTable dt = DSet.Tables[“开发商信息表”]; if (dt.Rows.Count > 0) { kaifashang = dt.Rows[0][0].ToString(); } else { kaifashang = null; } } SQLClass.con_close(); return kaifashang; } public string FangchanName(string num, bool isname) { string fangchan; if(isname) { DataSet DSet = SQLClass.getDataSet(“select jianzu from fangchan where id = ‘” + num + “‘”, “房产信息表”); DataTable dt = DSet.Tables[“房产信息表”]; if (dt.Rows.Count > 0) { fangchan = dt.Rows[0][0].ToString(); } else { fangchan = null; } } else { DataSet DSet = SQLClass.getDataSet(“select id from fangchan where jianzu = ‘” + num + “‘”, “房产信息表”); DataTable dt = DSet.Tables[“房产信息表”]; if (dt.Rows.Count > 0) { fangchan = dt.Rows[0][0].ToString(); } else { fangchan = null; } } return fangchan; } public string YezhuName(string num, bool isname) { string yezhu; if (isname) { DataSet DSet = SQLClass.getDataSet(“select xingming from yezhu where id = ‘” + num + “‘”, “业主信息表”); DataTable dt = DSet.Tables[“业主信息表”]; if (dt.Rows.Count > 0) { yezhu = dt.Rows[0][0].ToString(); } else { yezhu = “”; } } else { DataSet DSet = SQLClass.getDataSet(“select id from yezhu where xingming = ‘” + num + “‘”, “业主信息表”); DataTable dt = DSet.Tables[“业主信息表”]; if (dt.Rows.Count > 0) { yezhu = dt.Rows[0][0].ToString(); } else { yezhu = “”; } } return yezhu; } public string YuangongName(string num, bool isname) { string yuangong; if (isname) { DataSet DSet = SQLClass.getDataSet(“select xingming from yuangong where id = ‘” + num + “‘”, “员工信息表”); DataTable dt = DSet.Tables[“员工信息表”]; if (dt.Rows.Count > 0) { yuangong = dt.Rows[0][0].ToString(); } else { yuangong = “”; } } else { DataSet DSet = SQLClass.getDataSet(“select id from yuangong where xingming = ‘” + num + “‘”, “员工信息表”); DataTable dt = DSet.Tables[“员工信息表”]; if (dt.Rows.Count > 0) { yuangong = dt.Rows[0][0].ToString(); } else { yuangong = “”; } } return yuangong; } public string GangweiName(string num, bool isname) { string gangwei; if(isname) { DataSet DSet = SQLClass.getDataSet(“select gangwei from gangwei where id = ‘” + num + “‘”, “岗位信息表”); DataTable dt = DSet.Tables[“岗位信息表”]; if (dt.Rows.Count > 0) { gangwei = dt.Rows[0][0].ToString(); } else { gangwei = “”; } } else { DataSet DSet = SQLClass.getDataSet(“select id from gangwei where gangwei = ‘” + num + “‘”, “岗位信息表”); DataTable dt = DSet.Tables[“岗位信息表”]; if (dt.Rows.Count > 0) { gangwei = dt.Rows[0][0].ToString(); } else { gangwei = “”; } } return gangwei; } } }
|