/// <summary> /// 添加管理员通知类型 /// </summary> /// <param name="notifyType">通知类型对象</param> public void AddAdminNotifyType(AdminNotifyType notifyType) { try { string strSql = "insert into usta_AdminNotifyType("; strSql += "notifyTypeName,sequence,parentId) "; strSql += " values ("; strSql += "@notifyTypeName,@sequence,@parentId)"; SqlParameter[] parameters = { new SqlParameter("@notifyTypeName", SqlDbType.NVarChar,50), new SqlParameter("@sequence", SqlDbType.Int,4), new SqlParameter("@parentId", SqlDbType.Int,4)}; parameters[0].Value = notifyType.notifyTypeName; parameters[1].Value = notifyType.sequence; parameters[2].Value = notifyType.parentId; SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql, parameters); } catch (Exception ex) { MongoDBLog.LogRecord(ex); CommonUtility.RedirectUrl(); } finally { conn.Close(); } }
//****第3个标签:管理文章类型-------开始------------ protected void btnSubmit_Click(object sender, EventArgs e) { //若为浮点数则返回去 if (txtSequence.Text.Trim().IndexOf(".") != -1) { Javascript.GoHistory(-1, "显示顺序,请输入整数!", Page); return; } DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType(); AdminNotifyType type = new AdminNotifyType(); type.notifyTypeId = int.Parse(Request["notifyTypeId"].ToString().Trim()); type.notifyTypeName = txtTypeName.Text.Trim(); type.sequence = int.Parse(txtSequence.Text.Trim()); dalNotifyType.UpdateAdminNotifyType(type); Javascript.RefreshParentWindow("修改成功", "/Administrator/NotifyInfoManage.aspx?fragment=3", Page); }
/// <summary> /// 修改管理员通知类型 /// </summary> /// <param name="notifyType">通知类型实体</param> public void UpdateAdminNotifyType(AdminNotifyType notifyType) { try { string strSql = "update usta_AdminNotifyType set notifyTypeName=@notifyTypeName,sequence=@sequence where notifyTypeId=@notifyTypeId"; SqlParameter[] parameters = new SqlParameter[4]{ new SqlParameter("@notifyTypeId",notifyType.notifyTypeId), new SqlParameter("@notifyTypeName",notifyType.notifyTypeName), new SqlParameter("@sequence",notifyType.sequence), new SqlParameter("@parentId",notifyType.parentId) }; SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql, parameters); } catch (Exception ex) { MongoDBLog.LogRecord(ex); CommonUtility.RedirectUrl(); } finally { conn.Close(); } }
/// <summary> /// 查询第一个管理员通知类型 /// </summary> /// <returns>通知类型对象</returns> public AdminNotifyType FindTheFirstAdminNotifyType() { AdminNotifyType model = null; string commandstring = "select top 1 notifyTypeId,notifyTypeName,sequence from usta_AdminNotifyType "; SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.Text, commandstring); if (dr.Read()) { model = new AdminNotifyType { notifyTypeId = int.Parse(dr["notifyTypeId"].ToString().Trim()), notifyTypeName = dr["notifyTypeName"].ToString().Trim(), sequence = int.Parse(dr["sequence"].ToString().Trim()) }; } dr.Close(); conn.Close(); return model; }
/// <summary> /// 按照主键查找通知类型 /// </summary> /// <param name="notifyTypeId">通知类型主键</param> /// <returns>通知类型对象</returns> public AdminNotifyType FindAdminNotifyTypeById(int notifyTypeId) { AdminNotifyType model = null; string commandstring = "select notifyTypeId,notifyTypeName,sequence,parentId from usta_AdminNotifyType where notifyTypeId=@notifyTypeId"; SqlParameter[] parameters = new SqlParameter[1]{new SqlParameter("@notifyTypeId",notifyTypeId) }; SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.Text, commandstring, parameters); if (dr.Read()) { model = new AdminNotifyType { notifyTypeId = int.Parse(dr["notifyTypeId"].ToString().Trim()), notifyTypeName = dr["notifyTypeName"].ToString().Trim(), sequence = int.Parse(dr["sequence"].ToString().Trim()), parentId = int.Parse(dr["parentId"].ToString().Trim()) }; } dr.Close(); conn.Close(); return model; }