/// <summary> /// 向数据表DawnAuthModule中插入一条新记录 /// </summary> /// <param name="dawnAuthModule">DawnAuthModule实体对象</param> /// <param name="addFlag">添加标记:False 主分类,True 子分类</param> /// <returns></returns> public static int Insert(DawnAuthModuleMDL dawnAuthModule, bool addFlag) { if (dawnAuthModule == null) { return(0); } return(DawnAuthModuleBLL._dal.Insert(dawnAuthModule, addFlag)); }
/// <summary> /// 向数据表DawnAuthModule修改一条记录 /// </summary> /// <param name="dawnAuthModule">dawnAuthModule实体对象</param> /// <returns></returns> public static int Update(DawnAuthModuleMDL dawnAuthModule) { if (dawnAuthModule == null) { return(0); } return(DawnAuthModuleBLL._dal.Update(dawnAuthModule)); }
/// <summary> /// 递归模块信息·补空格模式 /// </summary> /// <param name="id">模块编号</param> /// <returns>数据集合</returns> public static IList <DawnAuthModuleMDL> GetTree(int id) { IList <DawnAuthModuleMDL> treeList = new List <DawnAuthModuleMDL>(); DawnAuthModuleMDL rootInfo = DawnAuthModuleBLL.Select(id); treeList.Add(rootInfo); GetTreeNode(treeList, rootInfo.MdlId, " "); return(treeList); }
/// <summary> /// 根据ID,返回一个DawnAuthModule实体对象 /// </summary> /// <param name="mdlId">模块编号</param> /// <returns>DawnAuthModule实体对象</returns> public DawnAuthModuleMDL Select(int mdlId) { DawnAuthModuleMDL obj = null; SqlParameter[] param = { new SqlParameter("@MdlId", SqlDbType.Int) }; param[0].Value = mdlId; string sqlCommand = "DawnAuthModuleSelect"; using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param)) { while (dr.Read()) { obj = this.Select(dr); } } return(obj); }
public string Added(FormCollection form) { var stateInfo = GeneralHandler.StateSuccess; if (AddedByCheck(form, out stateInfo)) { DawnAuthModuleMDL dataInfo = new DawnAuthModuleMDL(); int father = TypeHelper.TypeToInt32(form["ddlFather"], -1); dataInfo.MdlFather = father; dataInfo.MdlName = form["txtName"]; dataInfo.MdlCode = form["txtCode"]; dataInfo.MdlIdent = TypeHelper.TypeToInt32(form["txtIdent"], 0); dataInfo.MdlRank = TypeHelper.TypeToInt32(form["txtRank"], 255); dataInfo.MdlClick = 0; dataInfo.MdlCounts = 0; dataInfo.MdlDesc = form["txtDesc"]; dataInfo.MdlTime = DateTime.Now; bool added = false; if (father == -1) { added = DawnAuthModuleBLL.ExistsOfWhere(string.Format("(mdl_name='{0}' or mdl_code='{1}') and mdl_ident='{2}'", dataInfo.MdlName, dataInfo.MdlCode, dataInfo.MdlIdent)); } else { added = DawnAuthModuleBLL.ExistsOfWhere(string.Format("((mdl_name='{0}' and mdl_father='{1}') or mdl_code='{2}') and mdl_ident='{3}'", dataInfo.MdlName, father, dataInfo.MdlCode, dataInfo.MdlIdent)); } if (added) { stateInfo = GeneralHandler.StateAdded; } else { DawnAuthModuleBLL.Insert(dataInfo, father == -1 ? false : true); } } return(stateInfo); }
/// <summary> /// 得到DawnAuthModule实体对象 /// </summary> /// <param name="row">row</param> /// <returns>DawnAuthModule实体对象</returns> public DawnAuthModuleMDL Select(DataRow row) { DawnAuthModuleMDL obj = new DawnAuthModuleMDL(); if (row != null) { try { obj.MdlId = ((row["mdl_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["mdl_id"]); } catch { } try { obj.MdlName = row["mdl_name"].ToString(); } catch { } try { obj.MdlFather = ((row["mdl_father"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["mdl_father"]); } catch { } try { obj.MdlPath = row["mdl_path"].ToString(); } catch { } try { obj.MdlCode = row["mdl_code"].ToString(); } catch { } try { obj.MdlIdent = ((row["mdl_ident"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["mdl_ident"]); } catch { } try { obj.MdlRank = ((row["mdl_rank"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["mdl_rank"]); } catch { } try { obj.MdlClick = ((row["mdl_click"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["mdl_click"]); } catch { } try { obj.MdlCounts = ((row["mdl_counts"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["mdl_counts"]); } catch { } try { obj.MdlDesc = row["mdl_desc"].ToString(); } catch { } try { obj.MdlTime = ((row["mdl_time"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(row["mdl_time"]); } catch { } } else { return(null); } return(obj); }
/// <summary> /// 得到DawnAuthModule实体对象 /// </summary> /// <param name="dr">dr</param> /// <returns>DawnAuthModule实体对象</returns> public DawnAuthModuleMDL Select(IDataReader dr) { DawnAuthModuleMDL obj = new DawnAuthModuleMDL(); try { obj.MdlId = ((dr["mdl_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["mdl_id"]); } catch { } try { obj.MdlName = dr["mdl_name"].ToString(); } catch { } try { obj.MdlFather = ((dr["mdl_father"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["mdl_father"]); } catch { } try { obj.MdlPath = dr["mdl_path"].ToString(); } catch { } try { obj.MdlCode = dr["mdl_code"].ToString(); } catch { } try { obj.MdlIdent = ((dr["mdl_ident"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["mdl_ident"]); } catch { } try { obj.MdlRank = ((dr["mdl_rank"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["mdl_rank"]); } catch { } try { obj.MdlClick = ((dr["mdl_click"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["mdl_click"]); } catch { } try { obj.MdlCounts = ((dr["mdl_counts"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["mdl_counts"]); } catch { } try { obj.MdlDesc = dr["mdl_desc"].ToString(); } catch { } try { obj.MdlTime = ((dr["mdl_time"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(dr["mdl_time"]); } catch { } return(obj); }