public static void SubmitInterestOfAssignment(HttpClientHandler handler, AssignmentDetail assignment, string comment, string password) { try { var idData = System.Convert.FromBase64String(assignment.Id.Replace("_", "/").Replace("-", "=")); var detailUrl = System.Text.Encoding.UTF8.GetString(idData); HttpClient client = new HttpClient(handler); client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "VolontarPortal/1.0"); var httpContentValues = new List <KeyValuePair <string, string> >(assignment.InterestsValues); httpContentValues.Add(new KeyValuePair <string, string>("password", password)); httpContentValues.Add(new KeyValuePair <string, string>("comment", comment)); var httpContent = new FormUrlEncodedContent(httpContentValues); using (var response = client.PostAsync("http://volontar.polisen.se/" + assignment.InterestsFormUrl, httpContent).Result) { using (var responseContent = response.Content) { var pageContent = responseContent.ReadAsStringAsync().Result; // TODO: Validate result //return pageContent; } } } catch (System.Exception) { } }
private void dataViewAssignment_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataViewAssignment.SelectedRows.Count > 0) { int assignID = Convert.ToInt32(dataViewAssignment.SelectedRows[0].Cells[0].Value); DataTable dtAD = AssignmentDetail.GetListAssignmentDetails(assignID); dataViewAsssignmentDetail.DataSource = dtAD.DefaultView; } }
public ActionResult SaveAssignmentDetails(AssignmentDetail data, string QueueType = "OPD") { //var OpdIpd = data.OpdRegisters.OrderByDescending(e => e.Id).FirstOrDefault(); data.UserId = (int)Session["UserId"]; data.BranchId = 1; data.AddedOn = DateTime.Now; data.RequestStatus = true; db.AssignmentDetails.Add(data); if (db.SaveChanges() > 0) { var dat = new BillPayment(); var pa = db.AmbulanceMasters.FirstOrDefault(e => e.VehicleNumber == data.VehicleNumber); var nursereq = db.AmbulanceRequests.FirstOrDefault(e => e.OPDNo == data.OPDNo); pa.Engaged = true; nursereq.Assigned = true; var ambulance = db.Services.FirstOrDefault(e => e.Department.DepartmentName.Trim().ToLower().Contains("ambula")); var billService = new BillService(); billService.OPDNo = data.OPDNo; billService.DepartmentId = ambulance.DepartmentId; billService.SeviceId = ambulance.Id; billService.ServiceName = ambulance.ServiceName; billService.Price = ambulance.CashPrice; billService.Quatity = 1; billService.Award = 0; billService.DoctorFee = 0; billService.Paid = false; billService.Offered = false; billService.DateAdded = DateTime.Now; billService.UserId = int.Parse(Session["UserId"].ToString()); billService.BranchId = 1; billService.IsNurse = false; db.BillServices.Add(billService); db.SaveChanges(); } ViewBag.QueueType = QueueType; /* if (hs.IsUnderFive(data.PatientId) && hs.ExemptUnderFive()) * { * hs.AutoWaiver(billService.Id, "under 5 automatic waiver"); * }*/ return(RedirectToAction("AmbulatorIndex", new { id = data.Id })); }
private void buttonInsertFunction_Click(object sender, EventArgs e) { int selectedStaff = listBoxSystemStaff.SelectedIndex; if (CheckStaffInAssign(listStaff[selectedStaff].StaffID)) { MessageBox.Show("Nhân viên đã có trong danh sách phân công chăm sóc bệnh nhân", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { AssignmentDetail newAD = new AssignmentDetail(0, listStaff[selectedStaff].StaffID); listAD.Add(newAD); listBoxCurrentStaff.Items.Add(listBoxSystemStaff.Items[selectedStaff].ToString()); listBoxCurrentStaff.SelectedIndex = 0; } }
private void refreshDataViewAssignmentDetail() { if (dataViewAssignment.SelectedRows.Count > 0) { try { // Get AssignmentDetail's datatable int assignmentID = Convert.ToInt32(dataViewAssignment.Rows[0].Cells[0].Value); DataTable assignmentDetailTable = AssignmentDetail.GetListAssignmentDetails(assignmentID); // Set data source to dataview for searching dataViewAsssignmentDetail.DataSource = assignmentDetailTable.DefaultView; } catch { MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public ActionResult Approve(int?id) { // id = db.AmbulanceMasters.Where(e => e.Engaged == false); AssignmentDetail obj = db.AssignmentDetails.Find(id); if (obj != null) { obj.RequestStatus = false; UpdateModel(obj); // db.AmbulanceMasters.Add(obj); db.SaveChanges(); } else { return(Content("Not such an object")); } return(Content("Request Confirmed")); }
private void SetADForUpdate(Assignment assignDetail) { textBoxAssignID.Text = assignDetail.AssignID.ToString(); textBoxPatientID.Text = assignDetail.PatientID.ToString(); dateCreate.Value = assignDetail.Date; dateDischarge.Value = assignDetail.DischargedDate; dateHospitalize.Value = assignDetail.HospitalizateDate; dateHospitalize.Enabled = false; DataTable dtStaff = Staff.GetListStaff(); for (int i = 0; i < dtStaff.Rows.Count; i++) { String staffName = dtStaff.Rows[i][6].ToString() + " " + dtStaff.Rows[i][5].ToString(); Staff newStaff = Staff.GetStaff(Convert.ToInt32(dtStaff.Rows[i][0])); listStaff.Add(newStaff); listBoxSystemStaff.Items.Add(staffName); } listBoxSystemStaff.SelectedIndex = 0; DataTable dtAD = AssignmentDetail.GetListAssignmentDetails(assignDetail.AssignID); for (int i = 0; i < dtAD.Rows.Count; i++) { String staffName = dtAD.Rows[i][2].ToString() + " " + dtAD.Rows[i][3].ToString(); AssignmentDetail newAD = new AssignmentDetail(); newAD.AssignID = Convert.ToInt32(dtAD.Rows[i][0]); newAD.StaffID = Convert.ToInt32(dtAD.Rows[i][1]); listAD.Add(newAD); listBoxCurrentStaff.Items.Add(staffName); } if (listBoxCurrentStaff.Items.Count > 0) { listBoxCurrentStaff.SelectedIndex = 0; } }
private void buttonAssignmentDelete_Click(object sender, EventArgs e) { if (dataViewAssignment.SelectedRows.Count > 0) { int assignID = Convert.ToInt32(dataViewAssignment.SelectedRows[0].Cells[0].Value); DialogResult dialogResult = MessageBox.Show("Xác nhận xóa bản phân công", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { try { if (AssignmentDetail.DeleteAssignmentDetails(assignID) > 0 && Assignment.DeleteAssignment(assignID) > 0) { MessageBox.Show("Xóa bảng phân công thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch { MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } refreshDataViewAssignment(); refreshDataViewAssignmentDetail(); } }
private void buttonOk_Click(object sender, EventArgs e) { if (listBoxCurrentStaff.Items.Count > 0) { if (dateDischarge.Value > dateHospitalize.Value) { try { Assignment newAssign = new Assignment(); newAssign.PatientID = Convert.ToInt32(textBoxPatientID.Text); newAssign.DischargedDate = dateDischarge.Value; newAssign.HospitalizateDate = dateHospitalize.Value; newAssign.Date = dateCreate.Value; if (this.UserAction == "edit") { newAssign.AssignID = Convert.ToInt32(textBoxAssignID.Text); DialogResult dialogResult = MessageBox.Show("Xác nhận cập nhập thông tin bản phân công", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { if (Assignment.UpdateAssignment(newAssign) > 0) { AssignmentDetail.DeleteAssignmentDetails(newAssign.AssignID); for (int i = 0; i < listAD.Count; i++) { AssignmentDetail newAD = listAD[i]; newAD.AssignID = newAssign.AssignID; AssignmentDetail.InsertAssignmentDetails(newAD); } listAD.Clear(); MessageBox.Show("Cập nhập thông tin bảng phân công thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { newAssign.AssignID = 0; if (Assignment.InsertAssignment(newAssign) > 0) { int curAssignID = Assignment.GetCurrentIdentity(); for (int i = 0; i < listAD.Count; i++) { listAD[i].AssignID = curAssignID; AssignmentDetail.InsertAssignmentDetails(listAD[i]); } MessageBox.Show("Thêm bảng phân công thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch { MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } listAD.Clear(); this.Close(); } else { MessageBox.Show("Ngày xuất viện phải sau ngày nhập viện", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Chưa có nhân viên nào tham gia phân công chăm sóc bệnh nhân", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }