예제 #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Bitshare.DataDecision.Model.View_GroupButtonInfo DataRowToModel(DataRow row)
 {
     Bitshare.DataDecision.Model.View_GroupButtonInfo model = new Bitshare.DataDecision.Model.View_GroupButtonInfo();
     if (row != null)
     {
         if (row["Group_NameId"] != null && row["Group_NameId"].ToString() != "")
         {
             model.Group_NameId = int.Parse(row["Group_NameId"].ToString());
         }
         if (row["ButtonName"] != null)
         {
             model.ButtonName = row["ButtonName"].ToString();
         }
         if (row["Module_Name"] != null)
         {
             model.Module_Name = row["Module_Name"].ToString();
         }
         if (row["Group_Name"] != null)
         {
             model.Group_Name = row["Group_Name"].ToString();
         }
         if (row["ButtonNameId"] != null && row["ButtonNameId"].ToString() != "")
         {
             model.ButtonNameId = int.Parse(row["ButtonNameId"].ToString());
         }
         if (row["Rid"] != null && row["Rid"].ToString() != "")
         {
             model.Rid = int.Parse(row["Rid"].ToString());
         }
         if (row["Module_Id"] != null && row["Module_Id"].ToString() != "")
         {
             model.Module_Id = int.Parse(row["Module_Id"].ToString());
         }
         if (row["Right_Name"] != null)
         {
             model.Right_Name = row["Right_Name"].ToString();
         }
     }
     return(model);
 }
예제 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Bitshare.DataDecision.Model.View_GroupButtonInfo GetModel(int Group_NameId, string ButtonName, string Module_Name, string Group_Name, int ButtonNameId, int Rid, int Module_Id, string Right_Name)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Group_NameId,ButtonName,Module_Name,Group_Name,ButtonNameId,Rid,Module_Id,Right_Name from View_GroupButtonInfo ");
            strSql.Append(" where Group_NameId=@Group_NameId and ButtonName=@ButtonName and Module_Name=@Module_Name and Group_Name=@Group_Name and ButtonNameId=@ButtonNameId and Rid=@Rid and Module_Id=@Module_Id and Right_Name=@Right_Name ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Group_NameId", SqlDbType.Int,      4),
                new SqlParameter("@ButtonName",   SqlDbType.VarChar, 50),
                new SqlParameter("@Module_Name",  SqlDbType.VarChar, 50),
                new SqlParameter("@Group_Name",   SqlDbType.VarChar, 50),
                new SqlParameter("@ButtonNameId", SqlDbType.Int,      4),
                new SqlParameter("@Rid",          SqlDbType.Int,      4),
                new SqlParameter("@Module_Id",    SqlDbType.Int,      4),
                new SqlParameter("@Right_Name",   SqlDbType.VarChar, 50)
            };
            parameters[0].Value = Group_NameId;
            parameters[1].Value = ButtonName;
            parameters[2].Value = Module_Name;
            parameters[3].Value = Group_Name;
            parameters[4].Value = ButtonNameId;
            parameters[5].Value = Rid;
            parameters[6].Value = Module_Id;
            parameters[7].Value = Right_Name;

            Bitshare.DataDecision.Model.View_GroupButtonInfo model = new Bitshare.DataDecision.Model.View_GroupButtonInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }