private void GetRentInfo() { RentInfoModel rentInfo = new RentInfoModel(); conn.Open(); SqlCommand cmd = new SqlCommand("sp_Get_Rent_List", conn); cmd.CommandType = CommandType.StoredProcedure; DataTable dt = new DataTable(); using (var da = new SqlDataAdapter(cmd)) { cmd.CommandType = CommandType.StoredProcedure; da.Fill(dt); lvCustomers.DataSource = dt; lvCustomers.DataBind(); //foreach (DataRow dr in dt.Rows) //{ // //noticeInfo.NoticeId = dr["NoticeId"].ToString().Trim(); // //noticeInfo.PostedBy = dr["PostedByFN"].ToString().Trim() + " " + dr["PostedByLN"].ToString().Trim(); // //noticeInfo.GroupId = ""; // //noticeInfo.NoticeTitle = dr["NoticeTitle"].ToString().Trim(); // //noticeInfo.NoticeDetails = dr["NoticeDetails"].ToString().Trim(); // //noticeInfo.PostedOn = dr["PostedOn"].ToString().Trim(); // //noticeInfo.UpdatedOn = dr["UpdatedOn"].ToString().Trim(); // //noticeInfo.NoticeStatus = ""; // //noticeInfo.Remarks = dr["NoticeId"].ToString().Trim(); // //noticeInfoList.Add(noticeInfo); //} } conn.Close(); }
private void GetRentInfo() { RentInfoModel rentInfo = new RentInfoModel(); conn.Open(); SqlCommand cmd = new SqlCommand("sp_Get_Rent_List_by_Id", conn); cmd.Parameters.AddWithValue("@OwnerId", Session["SessionUserUserId"].ToString().Trim()); cmd.CommandType = CommandType.StoredProcedure; DataTable dt = new DataTable(); using (var da = new SqlDataAdapter(cmd)) { cmd.CommandType = CommandType.StoredProcedure; da.Fill(dt); lvCustomers.DataSource = dt; lvCustomers.DataBind(); } conn.Close(); }
public HttpResponseMessage RentExtraInfo(int id) { try { RentInfoBusiness repo = new RentInfoBusiness(); var result = repo.Find(id); RentInfoModel model = new RentInfoModel() { Customer = new Customers() { Address = result.Customers.Address, BeginningDateOfDriverLicense = result.Customers.BeginningDateOfDriverLicense, EndingDateOfDriverLicense = result.Customers.EndingDateOfDriverLicense, CityOfBirth = result.Customers.CityOfBirth, IdentificationNumber = result.Customers.IdentificationNumber, Name = result.Customers.Name, Surname = result.Customers.Surname }, Vehicle = new Vehicles() { Brand = result.Vehicles.Brand, ModelName = result.Vehicles.ModelName, Plate = result.Vehicles.Plate } }; return(Request.CreateResponse(HttpStatusCode.OK, model)); } catch (Exception ex) { LogHelper.Log(LogTarget.File, "Confirm Reent failed. " + id + "\n" + ExceptionHelper.ExceptionToString(ex)); return(null); } }