public M_Notice Show(int NoticeId) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@NoticeId", SqlDbType.Int, 4), new SqlParameter("@TypeId", SqlDbType.Int, 4) }; commandParameters[0].Value = NoticeId; commandParameters[1].Value = 4; M_Notice notice = new M_Notice(); DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "UP_Notice", commandParameters); notice.NoticeId = NoticeId; if (table.Rows.Count > 0) { notice.Title = table.Rows[0]["Title"].ToString(); notice.Content = table.Rows[0]["Content"].ToString(); if (table.Rows[0]["UserId"].ToString() != "") { notice.UserId = int.Parse(table.Rows[0]["UserId"].ToString()); } notice.UserName = table.Rows[0]["UserName"].ToString(); if (table.Rows[0]["OverdueDate"].ToString() != "") { notice.OverdueDate = DateTime.Parse(table.Rows[0]["OverdueDate"].ToString()); } if (table.Rows[0]["IsPriority"].ToString() != "") { notice.IsPriority = int.Parse(table.Rows[0]["IsPriority"].ToString()); } notice.IsState = table.Rows[0]["IsState"].ToString(); if (table.Rows[0]["AddDate"].ToString() != "") { notice.AddDate = DateTime.Parse(table.Rows[0]["AddDate"].ToString()); } return notice; } return null; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string NoticeId = Request.QueryString["NoticeId"]; if (NoticeId == null) { NoticeId = ""; } if (NoticeId != "") { model = BNotice.Show(int.Parse(NoticeId)); Label1.Text = model.Title; Label2.Text = model.Content; Label5.Text = model.OverdueDate.ToShortDateString(); Label4.Text = model.AddDate.ToShortDateString(); Label3.Text = model.UserName; } else { Response.Redirect("NoticeList.aspx"); Response.End(); } } }
public void Insert(M_Notice model) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Title", SqlDbType.NVarChar), new SqlParameter("@Content", SqlDbType.NText), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@UserName", SqlDbType.NVarChar), new SqlParameter("@OverdueDate", SqlDbType.DateTime), new SqlParameter("@IsPriority", SqlDbType.Int, 4), new SqlParameter("@IsState", SqlDbType.NVarChar), new SqlParameter("@AddDate", SqlDbType.DateTime), new SqlParameter("@TypeId", SqlDbType.Int, 4) }; commandParameters[0].Value = model.Title; commandParameters[1].Value = model.Content; commandParameters[2].Value = model.UserId; commandParameters[3].Value = model.UserName; commandParameters[4].Value = model.OverdueDate; commandParameters[5].Value = model.IsPriority; commandParameters[6].Value = model.IsState; commandParameters[7].Value = model.AddDate; commandParameters[8].Value = model.TypeId; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "UP_Notice", commandParameters); }
protected void Page_Load(object sender, EventArgs e) { AdminGroupBll.Power_Judge(46); if (!Page.IsPostBack) { //权限判断 string NoticeId = Request.QueryString["NoticeId"]; if (NoticeId == null) { NoticeId = ""; } if (NoticeId != "") { model = BNotice.Show(int.Parse(NoticeId)); Title.Text = model.Title; Content.Text = model.Content; OverdueDate.Text = model.OverdueDate.ToShortDateString(); IsPriority.Text = model.IsPriority.ToString(); IsState.SelectedValue = model.IsState; UserName.Text = model.UserName; } else { M_LoginAdmin model = AdminBll.GetLoginModel(); UserName.Text = model.AdminName.ToString(); OverdueDate.Text = DateTime.Now.AddMonths(1).ToShortDateString(); } OverdueDate.Attributes["Readonly"] = "true"; AddDate.Text = DateTime.Now.ToShortDateString(); } }
public void Update(M_Notice model) { this.inotice.Update(model); }
public void Insert(M_Notice model) { this.inotice.Insert(model); }
public void UpdateIsState(int NoticeId) { SqlParameter[] parameterArray; M_Notice notice = new M_Notice(); if (this.Show(NoticeId).IsState == "草稿") { parameterArray = new SqlParameter[] { new SqlParameter("@NoticeId", SqlDbType.Int, 4), new SqlParameter("@IsState", SqlDbType.NVarChar), new SqlParameter("@TypeId", SqlDbType.Int, 4) }; parameterArray[0].Value = NoticeId; parameterArray[1].Value = "审核通过"; parameterArray[2].Value = 5; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "UP_Notice", parameterArray); } else { parameterArray = new SqlParameter[] { new SqlParameter("@NoticeId", SqlDbType.Int, 4), new SqlParameter("@IsState", SqlDbType.NVarChar), new SqlParameter("@TypeId", SqlDbType.Int, 4) }; parameterArray[0].Value = NoticeId; parameterArray[1].Value = "草稿"; parameterArray[2].Value = 5; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "UP_Notice", parameterArray); } }