public string Added(FormCollection form) { var stateInfo = GeneralHandler.StateSuccess; if (AddedByCheck(form, out stateInfo)) { DawnAuthStatusMDL dataInfo = new DawnAuthStatusMDL(); dataInfo.StatTime = DateTime.Now; dataInfo.MdlId = int.Parse(form["ddlModule"]); dataInfo.StatName = form["txtName"]; dataInfo.StatCode = form["txtCode"]; dataInfo.StatMark = int.Parse(form["txtMark"]); dataInfo.StatDesc = form["txtDesc"]; bool added = DawnAuthStatusBLL.Exists(string.Format("stat_code='{0}'", dataInfo.StatCode)); if (added) { stateInfo = GeneralHandler.StateAdded; } else { DawnAuthStatusBLL.Insert(dataInfo); } } return(stateInfo); }
/// <summary> /// 向数据表DawnAuthStatus修改一条记录 /// </summary> /// <param name="dawnAuthStatus">DawnAuthStatus实体对象</param> /// <returns></returns> public static int Update(DawnAuthStatusMDL dawnAuthStatus) { if (dawnAuthStatus == null) { return(0); } return(DawnAuthStatusBLL._dal.Update(dawnAuthStatus)); }
/// <summary> /// 向数据表DawnAuthStatus中插入一条新记录 /// </summary> /// <param name="dawnAuthStatus">DawnAuthStatus实体对象</param> /// <returns></returns> public static int Insert(DawnAuthStatusMDL dawnAuthStatus) { if (dawnAuthStatus == null) { return(0); } return(DawnAuthStatusBLL._dal.Insert(dawnAuthStatus)); }
/// <summary> /// 向数据表DawnAuthStatus中插入一条新记录。带事务 /// </summary> /// <param name="sp">事务对象</param> /// <param name="dawnAuthStatus">DawnAuthStatus实体对象</param> /// <returns>ı</returns> public static int Insert(SqlTransaction sp, DawnAuthStatusMDL dawnAuthStatus) { if (dawnAuthStatus == null) { return(0); } return(DawnAuthStatusBLL._dal.Insert(sp, dawnAuthStatus)); }
/// <summary> /// 得到DawnAuthStatus实体对象 /// </summary> /// <param name="dr">dr</param> /// <returns>DawnAuthStatuss实体对象</returns> public DawnAuthStatusMDL Select(IDataReader dr) { DawnAuthStatusMDL obj = new DawnAuthStatusMDL(); try { obj.StatId = ((dr["stat_id"]) == DBNull.Value)?0:Convert.ToInt32(dr["stat_id"]); } catch { } try { obj.MdlId = ((dr["mdl_id"]) == DBNull.Value)?0:Convert.ToInt32(dr["mdl_id"]); } catch { } try { obj.StatTime = ((dr["stat_time"]) == DBNull.Value)?DateTime.MinValue:Convert.ToDateTime(dr["stat_time"]); } catch { } try { obj.StatName = dr["stat_name"].ToString(); } catch { } try { obj.StatCode = dr["stat_code"].ToString(); } catch { } try { obj.StatMark = ((dr["stat_mark"]) == DBNull.Value)?0:Convert.ToInt32(dr["stat_mark"]); } catch { } try { obj.StatDesc = dr["stat_desc"].ToString(); } catch { } try { obj.StatFieldOne = ((dr["stat_field_one"]) == DBNull.Value)?0:Convert.ToInt32(dr["stat_field_one"]); } catch { } try { obj.StatFieldTwo = ((dr["stat_field_two"]) == DBNull.Value)?Convert.ToByte(0):Convert.ToByte(dr["stat_field_two"]); } catch { } try { obj.StatFieldThree = dr["stat_field_three"].ToString(); } catch { } return(obj); }
/// <summary> /// 根据ID,返回一个DawnAuthStatus实体对象 /// </summary> /// <param name="statId">系统编号</param> /// <returns>DawnAuthStatus实体对象</returns> public DawnAuthStatusMDL Select(int statId) { DawnAuthStatusMDL obj = null; SqlParameter[] param = { new SqlParameter("@StatId", SqlDbType.Int) }; param[0].Value = statId; string sqlCommand = "DawnAuthStatusSelect"; using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param)) { while (dr.Read()) { obj = this.Select(dr); } } return(obj); }
/// <summary> /// 删除数据表DawnAuthStatus中的一条记录,带事务 /// </summary> /// <param name="sp">事务对象</param> /// <param name="dawnAuthStatus">DawnAuthStatus实体对象</param> /// <returns></returns> public int Delete(SqlTransaction sp, DawnAuthStatusMDL dawnAuthStatus) { return(DawnAuthStatusBLL._dal.Delete(sp, dawnAuthStatus)); }
/// <summary> /// 删除数据表DawnAuthStatus中的一条记录 /// </summary> /// <param name="dawnAuthStatus">DawnAuthStatus实体对象</param> /// <returns></returns> public static int Delete(DawnAuthStatusMDL dawnAuthStatus) { return(DawnAuthStatusBLL._dal.Delete(dawnAuthStatus)); }
/// <summary> /// 得到DawnAuthStatus实体对象 /// </summary> /// <param name="row">row</param> /// <returns>DawnAuthStatus实体对象</returns> public DawnAuthStatusMDL Select(DataRow row) { DawnAuthStatusMDL obj = new DawnAuthStatusMDL(); if (row != null) { try { obj.StatId = ((row["stat_id"]) == DBNull.Value)?0:Convert.ToInt32(row["stat_id"]); } catch { } try { obj.MdlId = ((row["mdl_id"]) == DBNull.Value)?0:Convert.ToInt32(row["mdl_id"]); } catch { } try { obj.StatTime = ((row["stat_time"]) == DBNull.Value)?DateTime.MinValue:Convert.ToDateTime(row["stat_time"]); } catch { } try { obj.StatName = row["stat_name"].ToString(); } catch { } try { obj.StatCode = row["stat_code"].ToString(); } catch { } try { obj.StatMark = ((row["stat_mark"]) == DBNull.Value)?0:Convert.ToInt32(row["stat_mark"]); } catch { } try { obj.StatDesc = row["stat_desc"].ToString(); } catch { } try { obj.StatFieldOne = ((row["stat_field_one"]) == DBNull.Value)?0:Convert.ToInt32(row["stat_field_one"]); } catch { } try { obj.StatFieldTwo = ((row["stat_field_two"]) == DBNull.Value)?Convert.ToByte(0):Convert.ToByte(row["stat_field_two"]); } catch { } try { obj.StatFieldThree = row["stat_field_three"].ToString(); } catch { } } else { return(null); } return(obj); }