public List <LienLac> LienLac_GetByTop(string Top, string Where, string Order) { List <Entity.LienLac> list = new List <Entity.LienLac>(); using (SqlCommand dbCmd = new SqlCommand("sp_LienLac_GetByTop", GetConnection())) { Entity.LienLac obj = new Entity.LienLac(); dbCmd.CommandType = CommandType.StoredProcedure; dbCmd.Parameters.Add(new SqlParameter("@Top", Top)); dbCmd.Parameters.Add(new SqlParameter("@Where", Where)); dbCmd.Parameters.Add(new SqlParameter("@Order", Order)); SqlDataReader dr = dbCmd.ExecuteReader(); dr.Close(); dr = dbCmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { list.Add(obj.LienLacIDataReader(dr)); } } dr.Close(); obj = null; } return(list); }
public bool LienLac_Insert(Entity.LienLac Data) { try { using (SqlCommand dbCmd = new SqlCommand("sp_LienLac_Insert", GetConnection())) { dbCmd.CommandType = CommandType.StoredProcedure; dbCmd.Parameters.Add(new SqlParameter("@Ten", Data.Ten)); dbCmd.Parameters.Add(new SqlParameter("@DiaChi", Data.DiaChi)); dbCmd.Parameters.Add(new SqlParameter("@DienThoai", Data.DienThoai)); dbCmd.Parameters.Add(new SqlParameter("@Email", Data.Email)); dbCmd.Parameters.Add(new SqlParameter("@ChuDe", Data.ChuDe)); dbCmd.Parameters.Add(new SqlParameter("@NoiDung", Data.NoiDung)); //dbCmd.Parameters.Add(new SqlParameter("@HinhThucThanhToan", Data.HinhThucThanhToan)); dbCmd.ExecuteNonQuery(); } //Clear cache System.Web.HttpContext.Current.Cache.Remove("LienLac"); return(true); } catch { return(false); } }
public Entity.LienLac LienLacIDataReader(IDataReader dr) { Entity.LienLac obj = new Entity.LienLac(); obj.Id = (dr["Id"] is DBNull) ? string.Empty : dr["Id"].ToString(); obj.Ten = (dr["Ten"] is DBNull) ? string.Empty : dr["Ten"].ToString(); obj.DiaChi = (dr["DiaChi"] is DBNull) ? string.Empty : dr["DiaChi"].ToString(); obj.DienThoai = (dr["DienThoai"] is DBNull) ? string.Empty : dr["DienThoai"].ToString(); obj.Email = (dr["Email"] is DBNull) ? string.Empty : dr["Email"].ToString(); obj.ChuDe = (dr["ChuDe"] is DBNull) ? string.Empty : dr["ChuDe"].ToString(); obj.NoiDung = (dr["NoiDung"] is DBNull) ? string.Empty : dr["NoiDung"].ToString(); return(obj); }
protected void btnGui_Click(object sender, EventArgs e) { Entity.LienLac obj = new Entity.LienLac(); obj.Ten = txtten.Text; obj.DiaChi = txtdiachi.Text; obj.DienThoai = txtdienthoai.Text; obj.Email = txtemail.Text; obj.ChuDe = txtchude.Text; obj.NoiDung = txtnoidung.Text; if (LienLacService.LienLac_Insert(obj) == true) { Response.Write("<script>alert('Cám ơn bạn đã gửi phản hồi về cho chúng tối!!!')</script>"); } ResetControl(); }
public static bool LienLac_Insert(Entity.LienLac data) { return(cmb.LienLac_Insert(data)); }