private void PushDataToDGV(string info) { //hàm trả về dữ liệu cho report thông qua flight number BussinessLayer objBLL = new BussinessLayer(); BussinessLayer objCabin = new BussinessLayer(); DataTable listCabin = objCabin.GetListCabin(); bool ans = new BussinessLayer().IsExistFN(info); if (ans == false) { MessageBox.Show("Flight number is invalid!"); } else { //đổ datasource cho datagridview dgvTotalAmenity.DataSource = objBLL.ReportAmenities(info); for (int i = 0; i < listCabin.Rows.Count; i++) { //gán header name thông qua list đã query trước dgvTotalAmenity.Rows[i].HeaderCell.Value = listCabin.Rows[i]["Name"].ToString(); } dgvTotalAmenity.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvTotalAmenity.RowHeadersWidth = 200; } }
private void btnSave_Click(object sender, EventArgs e) { //tạo ra messagebox xác nhận thanh toán string message = "Do you confirm buy there amenities?"; string title = "Save and confirm"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, title, buttons); if (result == DialogResult.Yes) { for (int i = 0; i < listAmentities.Rows.Count; i++) { BussinessLayer objBLL = new BussinessLayer(); string tick_id = cbxTicket.SelectedValue.ToString(); string amenity_id = listAmentities.Rows[i]["ID"].ToString(); //trường hợp mua thêm if (clbx.GetItemCheckState(i) == CheckState.Checked && String.IsNullOrEmpty(listAmentities.Rows[i]["Price_bought"].ToString())) { int price = int.Parse(listAmentities.Rows[i]["Price"].ToString()); objBLL.ChangeAmenTick(tick_id, amenity_id, "ADD", price); } //trường hợp xóa sản phẩm đã mua else if (clbx.GetItemCheckState(i) == CheckState.Unchecked && !String.IsNullOrEmpty(listAmentities.Rows[i]["Price_bought"].ToString())) { objBLL.ChangeAmenTick(tick_id, amenity_id, "DEL", 0); } } MessageBox.Show("Change buying amenities successfully"); Reset_Form(); } }
// GET: api/Users public async Task <HttpResponseMessage> Get() { BussinessLayer bussinessLayer = new BussinessLayer(); var UserList = await bussinessLayer.UsersList(); return(Request.CreateResponse(HttpStatusCode.OK, UserList)); }
// GET: api/Employee public async Task <HttpResponseMessage> Get() { BussinessLayer bussinesslayer = new BussinessLayer(); var userlist = await bussinesslayer.EmployeesList(); return(Request.CreateResponse(HttpStatusCode.OK, userlist)); }
static void Main(string[] args) { BussinessLayer firstObject = new BussinessLayer(); firstObject.UserControl(); Console.ReadLine(); }
protected void Page_Load(object sender, EventArgs e) { string subject = Request.QueryString.Get("Subject"); BussinessLayer bl = new BussinessLayer(); List <Message> lstmsg = bl.GetMessagesBySubject(subject); GridView1.DataSource = lstmsg; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { BussinessLayer bl = new BussinessLayer(); List <Message> Subjects = bl.GetAllSubjects(); DropDownList1.DataSource = Subjects; DropDownList1.DataTextField = "Subject"; DropDownList1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { Message msg = new Message { ParentName = TextBox3.Text, Subject = txtSub.Text, message = TextBox2.Text }; BussinessLayer bl = new BussinessLayer(); bl.PostMessage(msg); }
//public HttpResponseMessage GetEmployees() //{ // BussinessLayer bussinessLayer = new BussinessLayer(); // var UserList = bussinessLayer.EmployeesList; // return Request.CreateResponse(HttpStatusCode.OK, UserList); //} // GET: api/Employee/5 public async Task <HttpResponseMessage> Get(int id) { BussinessLayer bussinessLayer = new BussinessLayer(); var UserList = await bussinessLayer.EmployeesList(); var user = UserList.Where(u => u.id == id); if (user != null) { return(Request.CreateResponse(HttpStatusCode.OK, user)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound, "User not found")); } }
// GET: api/Users/5 //public string Get(int id) //{ // return "value"; //} // POST: api/Users public async Task <HttpResponseMessage> Post([FromBody] Users data) { BussinessLayer bussinessLayer = new BussinessLayer(); var UserList = await bussinessLayer.UsersList(); bool isValidUser = UserList.Any(u => u.username == data.username && u.password == data.password); if (isValidUser) { Users user = UserList.Where(u => u.username == data.username && u.password == data.password).FirstOrDefault(); return(Request.CreateResponse(HttpStatusCode.OK, user)); } else { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, new Exception())); } }
private void ChangeDate(object sender, EventArgs e) { BussinessLayer objBLL = new BussinessLayer(); DataTable listFlight = objBLL.GetListFlight(dtp.Text); if (listFlight.Rows.Count == 0) { MessageBox.Show("There aren't any Flight on this day!"); cbxFlight.DataSource = null; } else { cbxFlight.DataSource = listFlight; cbxFlight.DisplayMember = "FlightNumber"; //cbxFlight.ValueMember = "FlightNumber"; } }
public void bind() { try { int Employer_ID = Convert.ToInt32(Session["Employer_ID"]); DataSet ds = new DataSet(); bl = new BussinessLayer(); bl.Employer_ID = Employer_ID; ds = dl.EmployerRegistration_EmployerID_Display(bl); if (ds != null) { if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { txtName.Text = ds.Tables[0].Rows[0]["Name"].ToString(); txtEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString(); txtComapnyName.Text = ds.Tables[0].Rows[0]["CompanyName"].ToString(); txtContactPersonName.Text = ds.Tables[0].Rows[0]["ContactPersonName"].ToString(); txtAddress.Text = ds.Tables[0].Rows[0]["Address"].ToString(); txtCity.Text = ds.Tables[0].Rows[0]["City"].ToString(); txtState.Text = ds.Tables[0].Rows[0]["State"].ToString(); txtCountry.Text = ds.Tables[0].Rows[0]["Country"].ToString(); txtPinCode.Text = ds.Tables[0].Rows[0]["Pincode"].ToString(); txtMobileNumber.Text = ds.Tables[0].Rows[0]["MobileNumber"].ToString(); txtOwanerName.Text = ds.Tables[0].Rows[0]["OwanerName"].ToString(); txtDate.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["StartDate"]).ToString("yyyy-MM-dd"); DDLIndustryType.SelectedValue = ds.Tables[0].Rows[0]["IndustryType_ID"].ToString(); } else { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "Email or Password are incorrect"; } } else { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "Technincal Error"; } } catch { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "Technincal Error"; } }
protected void Button1_Click(object sender, EventArgs e) { Parent prnt = new Parent { ParentName = txtusername.Text, Password = txtpassword.Text }; BussinessLayer bl = new BussinessLayer(); bool value = bl.LoginUser(prnt); if (value == true) { Response.Redirect("~/Messages.aspx"); } else { txtmsg.Text = "This UserName doesn't exist. Please Register to Login"; } }
private void btnOK_Click(object sender, EventArgs e) { BussinessLayer objBLL = new BussinessLayer(); DataTable listTicket = objBLL.GetListTicket(txtBookingReference.Text); cbxTicket.DataSource = listTicket; //không tìm thấy chuyến bay theo mã booking if (listTicket.Rows.Count == 0) { MessageBox.Show("Cannot found Fight!"); Reset_Form(); } else { btnShowAmen.Enabled = true; cbxTicket.Enabled = true; cbxTicket.DisplayMember = "INFO"; cbxTicket.ValueMember = "ID"; } }
protected void Button1_Click(object sender, EventArgs e) { Parent prnt = new Parent { ParentName = txtusername.Text, Password = txtpassword.Text }; BussinessLayer bl = new BussinessLayer(); bool value = bl.UserNameExists(prnt.ParentName); if (value == true) { Label1.Text = "This UserName already exists"; } else { bl.RegisterUser(prnt); Label1.Text = "Registration Sucessfull. You can post your Message"; } }
public void Bind_ProfileData() { try { int JobSeeker_ID = Convert.ToInt32(Session["JobSeeker_ID"].ToString()); DataSet ds = new DataSet(); bl = new BussinessLayer(); bl.JobSeeker_ID = JobSeeker_ID; ds = dl.JobSeekerRegistrationBy_JobSeekerID_Display(bl); if (ds != null) { if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { txtFirstName.Text = ds.Tables[0].Rows[0]["FirstName"].ToString(); txtMiddleName.Text = ds.Tables[0].Rows[0]["MiddleName"].ToString(); txtLastName.Text = ds.Tables[0].Rows[0]["LastName"].ToString(); txtEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString(); txtContactNumber.Text = ds.Tables[0].Rows[0]["MobileNumber"].ToString(); txtAddress.Text = ds.Tables[0].Rows[0]["Address"].ToString(); txtPincode.Text = ds.Tables[0].Rows[0]["Pincode"].ToString(); } else { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "Email or Password are incorrect"; } } else { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "Technincal Error"; } } catch { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "Technical error"; } }
private void btnShowAmen_Click(object sender, EventArgs e) { clbx.DataSource = null; groupBox2.Controls.Clear(); BussinessLayer objBLL = new BussinessLayer(); string tick_id = cbxTicket.SelectedValue.ToString(); if (objBLL.IsInvalidHour(tick_id)) { btnSave.Enabled = true; total_price = 0; //Lấy ra thông tin tên tuổi, passport, cabin ngồi DataTable ticket_info = objBLL.GetTicketInfo(tick_id); lblFullName.Text = ticket_info.Rows[0]["Fullname"].ToString(); lblPassportNumber.Text = ticket_info.Rows[0]["PassportNumber"].ToString(); lblCabinClass.Text = ticket_info.Rows[0]["Name"].ToString(); // tạo ra list checkboxlist các dịch vụ clbx.Location = new Point(26, 19); clbx.Size = new System.Drawing.Size(550, 60); clbx.BackColor = CheckedListBox.DefaultBackColor; clbx.BorderStyle = BorderStyle.None; clbx.ColumnWidth = 180; clbx.MultiColumn = true; clbx.CheckOnClick = true; //đổ dữ liệu vào checklistbox BussinessLayer objAmentitiesBLL = new BussinessLayer(); listAmentities = objAmentitiesBLL.GetListAmenities(tick_id); clbx.DataSource = listAmentities; clbx.DisplayMember = "Info"; clbx.ValueMember = "ID"; groupBox2.Controls.Add(clbx); clbx.ItemCheck += Auto_Cal_Price; //các trạng thái tương ứng trong db: đã mua, chưa mua, free for (int i = 0; i < listAmentities.Rows.Count; i++) { if (listAmentities.Rows[i]["Price"].ToString() == "0") { //free clbx.SetItemCheckState(i, CheckState.Indeterminate); } else if (!String.IsNullOrEmpty(listAmentities.Rows[i]["Price_bought"].ToString())) { //trả phí - đã mua clbx.SetItemCheckState(i, CheckState.Checked); } else { //trả phí - chưa mua clbx.SetItemCheckState(i, CheckState.Unchecked); } } //mặc định giá ban đầu là 0 khi lấy từ db ra total_price = 0; lbTotalPrice.Text = "$0"; lbDuties.Text = "$0"; lbTotalPay.Text = "$0"; } else { btnSave.Enabled = false; MessageBox.Show("This service is avaibable up to 24 hours before the flight!"); } }