/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TS_RoleUSER GetTokenUserRoleModel(string C_TOKEN_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_ID,C_NAME,C_ACCOUNT,C_PASSWORD,C_EMAIL,C_MOBILE,N_TYPE,N_STATUS,C_DESC,D_LASTLOGINTIME,C_EMP_ID,C_EMP_NAME,D_MOD_DT,C_MOBILE2,C_PHONE,C_SHORTNAME,C_CUST_ID,C_TOKEN_ID,C_CJNAME,C_CJINTRO,C_STL_GRD,C_LEGALREPRES,C_CGJCR,C_JOB,C_JCTEL,C_ADDRESS,C_AREA,C_MANAGER from TS_USER "); strSql.Append(" where C_TOKEN_ID=:C_TOKEN_ID "); OracleParameter[] parameters = { new OracleParameter(":C_TOKEN_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = C_TOKEN_ID; Mod_TS_RoleUSER model = new Mod_TS_RoleUSER(); DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { model = DataRowToRoleModel(ds.Tables[0].Rows[0]); string sql = @"select c_id,c_code from ts_role where c_id in ( select t.c_role_id from ts_user_role t where t.c_user_id = '" + model.C_ID + "' )"; var dt = DbHelperOra.Query(sql).Tables[0]; foreach (DataRow item in dt.Rows) { model.Roles.Add(new Mod_TS_ROLE() { C_ID = item["C_ID"].ToString(), C_CODE = item["c_code"].ToString() }); } return(model); } else { return(null); } }
public Mod_TS_RoleUSER DataRowToRoleModel(DataRow row) { Mod_TS_RoleUSER model = new Mod_TS_RoleUSER(); if (row != null) { if (row["C_ID"] != null) { model.C_ID = row["C_ID"].ToString(); } if (row["C_NAME"] != null) { model.C_NAME = row["C_NAME"].ToString(); } if (row["C_ACCOUNT"] != null) { model.C_ACCOUNT = row["C_ACCOUNT"].ToString(); } if (row["C_PASSWORD"] != null) { model.C_PASSWORD = row["C_PASSWORD"].ToString(); } if (row["C_EMAIL"] != null) { model.C_EMAIL = row["C_EMAIL"].ToString(); } if (row["C_MOBILE"] != null) { model.C_MOBILE = row["C_MOBILE"].ToString(); } if (row["N_TYPE"] != null && row["N_TYPE"].ToString() != "") { model.N_TYPE = decimal.Parse(row["N_TYPE"].ToString()); } if (row["N_STATUS"] != null && row["N_STATUS"].ToString() != "") { model.N_STATUS = decimal.Parse(row["N_STATUS"].ToString()); } if (row["C_DESC"] != null) { model.C_DESC = row["C_DESC"].ToString(); } if (row["D_LASTLOGINTIME"] != null && row["D_LASTLOGINTIME"].ToString() != "") { model.D_LASTLOGINTIME = DateTime.Parse(row["D_LASTLOGINTIME"].ToString()); } if (row["C_EMP_ID"] != null) { model.C_EMP_ID = row["C_EMP_ID"].ToString(); } if (row["C_EMP_NAME"] != null) { model.C_EMP_NAME = row["C_EMP_NAME"].ToString(); } if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "") { model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString()); } if (row["C_MOBILE2"] != null) { model.C_MOBILE2 = row["C_MOBILE2"].ToString(); } if (row["C_PHONE"] != null) { model.C_PHONE = row["C_PHONE"].ToString(); } if (row["C_SHORTNAME"] != null) { model.C_SHORTNAME = row["C_SHORTNAME"].ToString(); } if (row["C_CUST_ID"] != null) { model.C_CUST_ID = row["C_CUST_ID"].ToString(); } if (row["C_TOKEN_ID"] != null) { model.C_TOKEN_ID = row["C_TOKEN_ID"].ToString(); } if (row["C_CJNAME"] != null) { model.C_CJNAME = row["C_CJNAME"].ToString(); } if (row["C_CJINTRO"] != null) { model.C_CJINTRO = row["C_CJINTRO"].ToString(); } if (row["C_STL_GRD"] != null) { model.C_STL_GRD = row["C_STL_GRD"].ToString(); } if (row["C_LEGALREPRES"] != null) { model.C_LEGALREPRES = row["C_LEGALREPRES"].ToString(); } if (row["C_CGJCR"] != null) { model.C_CGJCR = row["C_CGJCR"].ToString(); } if (row["C_JOB"] != null) { model.C_JOB = row["C_JOB"].ToString(); } if (row["C_JCTEL"] != null) { model.C_JCTEL = row["C_JCTEL"].ToString(); } if (row["C_ADDRESS"] != null) { model.C_ADDRESS = row["C_ADDRESS"].ToString(); } if (row["C_AREA"] != null) { model.C_AREA = row["C_AREA"].ToString(); } if (row["C_MANAGER"] != null) { model.C_MANAGER = row["C_MANAGER"].ToString(); } } return(model); }