protected void btnSubmit_Click(object sender, EventArgs e) { int _count = 0; Model.Flash model = new Model.Flash(); if (id > 0) { model = bll.GetModel(this.id, -1, 1, 1); } model.Title = txtTitle.Text.Trim(); model.Link = txtLink.Text.Trim(); model.Image = txtImage.Value; model.Intro = txtIntro.Value; model.Status = Convert.ToInt32(rdStatus.SelectedValue); bll.Update(model, ref _count); if (_count > 0) { JscriptMsg("Cập nhật thành công !", "List.aspx", "Success"); } else { JscriptMsg("Lỗi xảy ra !", "", "Error"); } }
private void ShowInfo() { Model.Flash model = new Model.Flash(); model = bll.GetModel(this.id, -1, 1, 1); if (null != model && model.Id > 0) { txtTitle.Text = model.Title; txtLink.Text = model.Link; txtImage.Value = model.Image; txtIntro.Value = model.Intro; rdStatus.SelectedValue = model.Status.ToString(); } }
public List<Model.Flash> GetList(int _Id, int _Status, int _Start, int _Limit) { List<Model.Flash> ModelList = new List<Model.Flash>(); try { SqlParameter[] p = { new SqlParameter("@Id", SqlDbType.Int, 4), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@Start", SqlDbType.Int, 4), new SqlParameter("@Limit", SqlDbType.Int, 4) }; p[0].Value = _Id; p[1].Value = _Status; p[2].Value = _Start; p[3].Value = _Limit; DataTable dt = db.ExcuteSelectReturnDataTable("Flash_Select", CommandType.StoredProcedure, p); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { Model.Flash model = new Model.Flash(); model.Ind = Convert.ToInt32(dr["Ind"]); model.Id = Convert.ToInt32(dr["Id"]); model.Title = dr["Title"].ToString(); model.Image = dr["Image"].ToString(); model.Link = dr["Link"].ToString(); model.Intro = dr["Intro"].ToString(); model.Status = Convert.ToInt32(dr["Status"]); model.StatusText = dr["Statustext"].ToString(); ModelList.Add(model); } } } catch (Exception ex) { PTSLog.Error(ex.Message); } return ModelList; }