/// <summary> /// 获取角色名称 /// </summary> /// <returns></returns> public string getRoleName() { bll.rolebll roleBll = new bll.rolebll(); int id = helpcommon.ParmPerportys.GetNumParms(Request.Form["roleId"].ToString()); model.persona mdPersona = roleBll.getRoleName(id); return(mdPersona.PersonaName); }
/// <summary> /// 得到一个对象实体 /// </summary> public List <model.persona> DataRowToModel(DataRowCollection rowCollection) { List <model.persona> list = new List <model.persona>(); foreach (DataRow row in rowCollection) { model.persona modelMd = new model.persona(); if (row != null) { if (row["Id"] != null && row["Id"].ToString() != "") { modelMd.Id = int.Parse(row["Id"].ToString()); } if (row["PersonaName"] != null) { modelMd.PersonaName = row["PersonaName"].ToString(); } if (row["PersonaIndex"] != null && row["PersonaIndex"].ToString() != "") { modelMd.PersonaIndex = int.Parse(row["PersonaIndex"].ToString()); } if (row["UserId"] != null && row["UserId"].ToString() != "") { modelMd.UserId = int.Parse(row["UserId"].ToString()); } if (row["Def1"] != null) { modelMd.Def1 = row["Def1"].ToString(); } if (row["Def2"] != null) { modelMd.Def2 = row["Def2"].ToString(); } if (row["Def3"] != null) { modelMd.Def3 = row["Def3"].ToString(); } if (row["Def4"] != null) { modelMd.Def4 = row["Def4"].ToString(); } if (row["Def5"] != null) { modelMd.Def5 = row["Def5"].ToString(); } } list.Add(modelMd); } return(list); }
/// <summary> /// 编辑角色 /// </summary> /// <returns></returns> public ActionResult editRole(int id) { bll.rolebll roleBll = new bll.rolebll(); IDataParameter[] ipara = new IDataParameter[] { new SqlParameter("id", SqlDbType.Int, 4) }; ipara[0].Value = id; List <model.persona> list = roleBll.getRole(ipara, "roleEdit"); model.persona roleMd = new model.persona(); roleMd = list.Where(c => c.Id == id).ToList()[0]; return(View(roleMd)); }
/// <summary> /// 获取角色名称 /// </summary> /// <param name="id"></param> /// <returns></returns> public model.persona getRoleName(int id) { model.persona mdPersona = new model.persona(); //model.ConnectionString md = new model.ConnectionString(); //var s = from c in md.persona where c.Id==id select c; //foreach (var item in s) //{ // mdPersona = item; //} //return mdPersona; model.pbxdatasourceDataContext context = new model.pbxdatasourceDataContext(); var s = from c in context.persona where c.Id == id select c; foreach (var item in s) { mdPersona = item; } return(mdPersona); }
/// <summary> /// 获取角色名称 /// </summary> /// <returns></returns> public string getRoleName() { bll.rolebll roleBll = new bll.rolebll(); model.persona mdPersona = roleBll.getRoleName(1); return(mdPersona.PersonaName); }