public IEnumerable <AccountBO> DeleteAccountDetail_DAL(AccountBO accountBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Account account = objHmsDataContext.Accounts.Where(acnt => (acnt.Bill_ID == accountBO.bill_ID)).SingleOrDefault(); objHmsDataContext.Accounts.DeleteOnSubmit(account); objHmsDataContext.SubmitChanges(); return(GetAllAccounts_DAL()); } } catch (Exception e) { IEnumerable <AccountBO> result = null; return(result); } }
//Method to update AccountDetails, with return type string public string UpdateAccountDetails_DAL(AccountBO accountBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Account account = null; if (accountBO.payment_ID != 0) { account = objHmsDataContext.Accounts.Where(accountDetails => (accountDetails.Patient_ID == accountBO.patient_ID && accountDetails.Payment_ID == accountBO.payment_ID) ).First(); } else { account = objHmsDataContext.Accounts.Where(accountDetails => (accountDetails.Patient_ID == accountBO.patient_ID && accountDetails.Bill_ID == accountBO.bill_ID)).First(); } Account updatedAccount = ConvertBOToAccount(account, accountBO); objHmsDataContext.SubmitChanges(); return("Account updated successfully"); } } catch (Exception e) { return("Unable to update account details please try again later "); } }
private void ManageEmploy_Form_Load(object sender, EventArgs e) { AccountBO list = new AccountBO(); DataSet ds = list.ShowListNV();// lấy dữ liệu từ database đổ vào 1 table dgv_Thongtinnv.DataSource = ds.Tables[0]; if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { txt_UsernameNV.Text = dgv_Thongtinnv.CurrentRow.Cells["Username"].Value.ToString(); txt_Name.Text = dgv_Thongtinnv.CurrentRow.Cells["Name"].Value.ToString(); txt_Password.Text = dgv_Thongtinnv.CurrentRow.Cells["Password"].Value.ToString(); txt_Address.Text = dgv_Thongtinnv.CurrentRow.Cells["Address"].Value.ToString(); cmb_Sex.Text = dgv_Thongtinnv.CurrentRow.Cells["Sex"].Value.ToString(); dt_DOB.Text = dgv_Thongtinnv.CurrentRow.Cells["DOB"].Value.ToString(); cmb_Position.Text = dgv_Thongtinnv.CurrentRow.Cells["Position"].Value.ToString(); txt_NumberPhone.Text = dgv_Thongtinnv.CurrentRow.Cells["NumberPhone"].Value.ToString(); } else { txt_UsernameNV.Text = ""; txt_Name.Text = ""; txt_Password.Text = ""; txt_Address.Text = ""; cmb_Sex.Text = ""; dt_DOB.Text = ""; cmb_Position.Text = ""; txt_NumberPhone.Text = ""; } loadcbm(); //Enable(true); }
//get all account details based on account ID public IEnumerable <AccountBO> GetAccountsByID_DAL(AccountBO accountBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } IEnumerable <AccountBO> accountDetails = objHmsDataContext.Accounts.Where(a => a.Bill_ID == accountBO.bill_ID || a.Patient_ID == accountBO.patient_ID || a.Payment_ID == accountBO.payment_ID).Select(a => new AccountBO { patient_ID = a.Patient_ID, bill_ID = a.Bill_ID, payment_ID = a.Payment_ID, total_Amount = Convert.ToDouble(a.Total_Amount), generatedDate_Time = a.Generated_Date_Time, // paidDate_Time = a.Paid_Date_Time, hospital_Fee = Convert.ToDouble(a.Hospital_Fee), medicines_Fee = Convert.ToDouble(a.Medicines_Fee), room_Fee = a.Room_Fee != null? Convert.ToDouble(a.Room_Fee):0, paid_Amount = Convert.ToDouble(a.Paid_Amount), appointment_ID = a.Appointment_ID }).ToArray(); return(accountDetails); } } catch (Exception e) { IEnumerable <AccountBO> accountDetails = null; return(accountDetails); } }
public IEnumerable <AccountBO> AccountUpdateDetails_DAL(AccountBO accountBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Account account = objHmsDataContext.Accounts.SingleOrDefault(accountDetails => (accountDetails.Bill_ID == accountBO.bill_ID)); Account updatedAccount = ConvertBOToAccount(account, accountBO); objHmsDataContext.SubmitChanges(); return(GetAllAccounts_DAL()); } } catch (Exception e) { IEnumerable <AccountBO> accounts = null; return(accounts); } }
//Method to get Payment by Patient, with return type of Account Business object public AccountBO GetAccountDetails_DAL(AccountBO accountBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Account accountDetails = objHmsDataContext.Accounts.SingleOrDefault(account => account.Bill_ID == accountBO.bill_ID); if (accountDetails != null) { AccountBO acount_BO = ConvertAccountToBO(accountDetails); return(acount_BO); } else { AccountBO account_BO = new AccountBO(); return(account_BO); } } } catch (Exception e) { AccountBO appBO = new AccountBO(); return(appBO); } }
private void textEdit1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Up) { AccountBO a = new AccountBO(); List <Account> b = a.CheckUser(textEdit1.Text); if (textEdit1.Text == "" || textEdit1.Text == "Username") { labelControl2.Text = "Please complete all information!"; labelControl2.Location = new Point(52, 150); labelControl2.Size = new Size(225, 25); labelControl2.ForeColor = Color.Red; labelControl2.Visible = true; textEdit1.Focus(); } else { labelControl2.Visible = false; if (b.Count.ToString() == "0") { labelControl2.Text = "The username don't alreally exixts. Please check again!"; labelControl2.Location = new Point(52, 150); labelControl2.Size = new Size(225, 25); labelControl2.ForeColor = Color.Red; labelControl2.Visible = true; textEdit1.Focus(); } if (b.Count.ToString() == "1") { textEdit2.Focus(); } } } }
/// <summary> /// Verify Login process /// User passes in a user name and password and will be redirected on if successful /// </summary> /// <param name="userId">User name the customer is authenticating with</param> /// <param name="password">Password the customer is using</param> /// <returns>true if the login is successful</returns> public bool ProcessLogin(string userId, string password) { // Use the account business logic layer to login AccountBO account = new AccountBO(); AccountInfo myAccountInfo = account.SignIn(userId, password); //If login is successful then store the state in session and redirect if (myAccountInfo != null) { HttpContext.Current.Session[ACCOUNT_KEY] = myAccountInfo; // Determine where to redirect the user back too // If they came in from the home page, take them to a similar page if (FormsAuthentication.GetRedirectUrl(userId, false).EndsWith(URL_DEFAULT)) { FormsAuthentication.SetAuthCookie(userId, false); HttpContext.Current.Response.Redirect(URL_ACCOUNTSIGNIN, true); } else { // Take the customer back to where the came from FormsAuthentication.SetAuthCookie(userId, false); HttpContext.Current.Response.Redirect(FormsAuthentication.GetRedirectUrl(userId, false), true); } return(true); } else { // Login has failed so return false return(false); } }
private void btn_Delete_Click(object sender, EventArgs e) { DialogResult tb = MessageBox.Show("Bạn có muốn xóa không ?", "Thông Báo ", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (tb == DialogResult.Yes) { AccountBO del = new AccountBO(); if (del.DeleteNV(txt_UsernameNV.Text) != -1) // xóa gọi tới hàm delNV của class NhanVienControls { stateContext.setState(new StateDeleteUser()); stateContext.applyState(); } else { stateContext.setState(new Error()); stateContext.applyState(); } } else { MessageBox.Show("Nhớ Suy Nghĩ Kĩ Rồi Hãy Lựa Chọn ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ManageEmploy_Form_Load(sender, e);// hiển thị dữ liệu lên lại giao diện }
//Method to delete records in Account table, with return type of Account Business object public string DeleteAccount_DAL(AccountBO accountBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Account account = objHmsDataContext.Accounts.SingleOrDefault(acnt => ((acnt.Patient_ID == accountBO.patient_ID && acnt.Payment_ID == accountBO.payment_ID) || acnt.Bill_ID == accountBO.bill_ID)); objHmsDataContext.Accounts.DeleteOnSubmit(account); objHmsDataContext.SubmitChanges(); return("Successfully Account record deleted"); } } catch (Exception e) { return("Unable to delete now please try again later"); } }
public JsonResult EditRoleUser(string idColumna, string rolEditado, string estadoUsuario) { var UsersContext = new ApplicationDbContext(); var oldUser = UserManager.FindById(idColumna); var oldRoleId = oldUser.Roles.SingleOrDefault().RoleId; var oldRoleName = UsersContext.Roles.SingleOrDefault(r => r.Id == oldRoleId).Name; AccountBO accBO = new AccountBO(); if (rolEditado != null) { if (oldRoleName != rolEditado) { UserManager.RemoveFromRole(idColumna, oldRoleName); UserManager.AddToRole(idColumna, rolEditado); } bool estadoUs = false; if (estadoUsuario == "1") { estadoUs = true; accBO.editarUsuario(oldUser, estadoUs); } else { estadoUs = false; accBO.editarUsuario(oldUser, estadoUs); } } return(Json("Ok", JsonRequestBehavior.AllowGet)); }
public IEnumerable <PaymentBO> PatientPayPayments(PaymentBO paymentBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } var p = GetPatientPayments(paymentBO.patient_ID).Last().paid_Amount; InsertPatientPayments(paymentBO); //paymentBO.paid_Amount = paymentBO.paid_Amount + p; var pp = GetPatientPayments(paymentBO.patient_ID); var paidTotal = pp.Where(d => d.bill_ID == paymentBO.bill_ID).Select(h => h.paid_Amount).ToList().Sum(); AccountDAL acc = new AccountDAL(); AccountBO accBO = new AccountBO(); accBO.patient_ID = paymentBO.patient_ID; accBO.bill_ID = paymentBO.bill_ID; accBO.paid_Amount = paidTotal; accBO.generatedDate_Time = DateTime.Now; acc.UpdateAccountDetails_DAL(accBO); return(pp); } } catch (Exception e) { IEnumerable <PaymentBO> payment_BO = null; return(payment_BO); } }
public void InsertPaymentAfterBillGeneration(AccountBO accBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } objHmsDataContext.Payments.InsertOnSubmit(new Payment { Patient_ID = accBO.patient_ID, Hospital_Fee = Convert.ToDecimal(accBO.hospital_Fee), Medicines_Fee = Convert.ToDecimal(accBO.medicines_Fee), Room_Fee = accBO.room_Fee != 0 ? Convert.ToDecimal(accBO.room_Fee) :0, Total_Amount = Convert.ToDecimal(accBO.hospital_Fee) + Convert.ToDecimal(accBO.medicines_Fee), Paid_Amount = 0, Date_Time = DateTime.Now, Bill_ID = accBO.bill_ID }); objHmsDataContext.SubmitChanges(); } } catch (Exception ex) { } }
//Method to get Payment by Patient, with return type of Account Business object public AccountBO GetAccountDetailsForBiiling_DAL(AccountBO accountBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } AccountBO accountDetails = objHmsDataContext.Accounts.Where(account => account.Patient_ID == accountBO.patient_ID && account.Generated_Date_Time == accountBO.generatedDate_Time && account.Total_Amount == (decimal)accountBO.total_Amount) .Select(a => new AccountBO { bill_ID = a.Bill_ID, total_Amount = Convert.ToDouble(a.Total_Amount), paid_Amount = Convert.ToDouble(a.Paid_Amount), medicines_Fee = Convert.ToDouble(a.Medicines_Fee), hospital_Fee = Convert.ToDouble(a.Hospital_Fee), room_Fee = a.Room_Fee != null ? Convert.ToDouble(a.Room_Fee) : 0, patient_ID = a.Patient_ID, appointment_ID = a.Appointment_ID, generatedDate_Time = a.Generated_Date_Time }).First(); return(accountDetails); } } catch (Exception e) { AccountBO appBO = new AccountBO(); return(appBO); } }
public void UpdateAccount(AccountBO accountBo) { var account = _unitOfWork.AccountTable.GetSingle(accountBo.Id); account.AccountDetail.AccountName = accountBo.Name; account.AccountDetail.Overdraft = accountBo.Overdraft; _unitOfWork.Commit(); }
public IEnumerable <AccountBO> GetAccountsByBillID(AccountBO accountBO) { AccountBLLFactory accBLLFactory = new AccountBLLFactory(); IEnumerable <AccountBO> account_BO = accBLLFactory.createAccountBLL().GetAccountDetails().CreateAccountDAL().GetAccountsByID_DAL(accountBO); return(account_BO); }
//Method to convert Account to BO, with return type of Account Business object public AccountBO ConvertAccountToBO(Account account) { AccountBO accountBO = new AccountBO(account.Patient_ID, account.Bill_ID, account.Payment_ID, Convert.ToDouble(account.Total_Amount), Convert.ToDouble(account.Paid_Amount), Convert.ToDouble(account.Medicines_Fee), Convert.ToDouble(account.Hospital_Fee), account.Generated_Date_Time, (account.Room_Fee != null ? Convert.ToDouble(account.Room_Fee) : 0)); return(accountBO); }
// GET: api/Account/5 //Get Action to retrieve Account details, Account business object as return type and int as parameter public AccountBO Get(int id) { AccountBLLFactory accBLLFactory = new AccountBLLFactory(); AccountBO acc_BO = new AccountBO(); AccountBO account_BO = accBLLFactory.createAccountBLL().GetAccountDetails().CreateAccountDAL().GetAccountDetails_DAL(acc_BO); return(account_BO); }
public CreateUserResponse CreateAccount(Patient patient) { CreateUserResponse response = new CreateUserResponse(); Account account; AccountBO registrationBO = new AccountBO(); account = registrationBO.CreateAccount(patient); response.account = account; return(response); }
private AccountManager() { _tobObjects = new List<TOBBaseObject>(); _accountBO = new AccountBO(); _cachedAccountList = _accountBO.GetAll(); //Populate and create TOBBaseObject list from account object PopulateTOBBaseObjectList(); }
public IEnumerable <AccountBO> SaveAccountDetail(AccountBO accountBO) { try { AdministratorBLLFactory adminBLLFactory = new AdministratorBLLFactory(); return(adminBLLFactory.CreateAdministratorBLL().ManageAccountsBLL().CreateAccountDAL().AccountUpdateDetails_DAL(accountBO)); } catch (Exception ex) { return(null); } }
//Method to convert BO to Account, with return type of Account Business object public Account ConvertBOToAccount(Account account, AccountBO accountBO) { if (accountBO.patient_ID != 0) { account.Patient_ID = accountBO.patient_ID; } if (accountBO.payment_ID != 0) { account.Payment_ID = accountBO.payment_ID; } if (accountBO.total_Amount != 0) { account.Total_Amount = (decimal)(accountBO.total_Amount); } if (accountBO.paid_Amount != 0) { account.Paid_Amount = (decimal)(accountBO.paid_Amount); } if (accountBO.medicines_Fee != 0) { account.Medicines_Fee = (decimal)(accountBO.medicines_Fee); } if (accountBO.hospital_Fee != 0) { account.Hospital_Fee = (decimal)(accountBO.hospital_Fee); } if (accountBO.generatedDate_Time != DateTime.MinValue) { account.Generated_Date_Time = accountBO.generatedDate_Time; } if (accountBO.bill_ID != 0) { account.Bill_ID = accountBO.bill_ID; } if (accountBO.appointment_ID != 0) { account.Appointment_ID = accountBO.appointment_ID; } if (accountBO.room_Fee != 0) { account.Room_Fee = (decimal)(accountBO.room_Fee); } return(account); }
public ActionResult OrderBilling() { AccountController accountController = new AccountController(); AccountInfo myAccount = accountController.GetAccountInfo(true); if (myAccount != null) { AccountBO account = new AccountBO(); //billAddr.Address = account.GetAddress(myAccount.UserId); } return(View()); }
/// <summary> /// A method to process an updated account /// </summary> /// <param name="updatedAccountInfo">Updated account information</param> public void UpdateAccount(AccountInfo updatedAccountInfo) { // Create the business logic tier AccountBO account = new AccountBO(); // Call the udpate method account.Update(updatedAccountInfo); //Store the update info back in session state HttpContext.Current.Session[ACCOUNT_KEY] = updatedAccountInfo; //Redirect the user to the my account page HttpContext.Current.Response.Redirect(URL_ACCOUNTUPDATE, true); }
public void AccountBLLTest() { AccountBO accountBLL = new AccountBO(); AccountInfo a1 = accountBLL.SignIn("ACID", "ACID"); //系统内置的账户 Assert.IsNotNull(a1); AccountInfo a2 = accountBLL.SignIn("DotNet", "DotNet"); Assert.IsNotNull(a2); Assert.AreEqual <string>(a1.UserId, "ACID"); AccountInfo a3 = accountBLL.SignIn("abc", "hello");//不存在的账户, 结果应该为Null Assert.IsNull(a3); }
// DELETE: api/Account/5 //Delete action, which accepts integer as parameter and void as return type public void Delete(int id) { AccountBO acc_BO = new AccountBO(); acc_BO.generatedDate_Time = DateTime.Parse("2222/10/10"); acc_BO.paidDate_Time = DateTime.Parse("2222/10/10"); acc_BO.patient_ID = 7002; acc_BO.total_Amount = 4321.26; acc_BO.paid_Amount = 4321.309; acc_BO.payment_ID = 3; acc_BO.account_ID = 9005; AccountBLLFactory accBLLFactory = new AccountBLLFactory(); string deleteAcc = accBLLFactory.createAccountBLL().DeleteAccountDetails().CreateAccountDAL().DeleteAccount_DAL(acc_BO); }
// PUT: api/Account/5 //Put action accepts integer and account business object as parameter, void as return type public void Put(int id, [FromBody] AccountBO acc_BO) { AccountBO accBO = new AccountBO(); acc_BO.generatedDate_Time = DateTime.Parse("2222/10/10"); acc_BO.paidDate_Time = DateTime.Parse("2222/10/10"); accBO.patient_ID = 7002; accBO.payment_ID = 3; accBO.total_Amount = 4321.26; accBO.paid_Amount = 4321.309; AccountBLLFactory accBLLFactory = new AccountBLLFactory(); string updateAcc = accBLLFactory.createAccountBLL().UpdateAccountDetails().CreateAccountDAL().UpdateAccountDetails_DAL(accBO); }
// POST: api/Account // Post Action, accepts Account buisness object as parameter with void as return type public void Post([FromBody] AccountBO accBO) { AccountBO acc_BO = new AccountBO(); acc_BO.generatedDate_Time = DateTime.Parse("2222/10/10"); acc_BO.paidDate_Time = DateTime.Parse("2222/10/10"); acc_BO.patient_ID = 7002; acc_BO.payment_ID = 3; acc_BO.total_Amount = 1234.26; acc_BO.paid_Amount = 1234.309; AccountBLLFactory accBLLFactory = new AccountBLLFactory(); AccountBO newAcc = accBLLFactory.createAccountBLL().CreateAccountDetails().CreateAccountDAL().InsertAccountDetails_DAL(acc_BO); }
public ActionResult ForgetPasswordMessage(FormCollection form) { string Lwr_email = form["email"]; AccountBO acbo = new AccountBO(); if (acbo.ForgotPassword(Lwr_email)) { ViewBag.ForgotMsg = true; return(View()); } else { ViewBag.ForgotMsg = false; return(View()); } }
// GET: api/Account/5 //Get Action to retrieve Account details, Account business object as return type and int as parameter public AccountBO Get(int id) { AccountBLLFactory accBLLFactory = new AccountBLLFactory(); AccountBO acc_BO = new AccountBO(); acc_BO.generatedDate_Time = DateTime.Parse("2222/10/10"); acc_BO.paidDate_Time = DateTime.Parse("2222/10/10"); acc_BO.patient_ID = 7002; acc_BO.total_Amount = 1234.26; acc_BO.paid_Amount = 1234.309; acc_BO.payment_ID = 3; acc_BO.account_ID = id; AccountBO account_BO = accBLLFactory.createAccountBLL().GetAccountDetails().CreateAccountDAL().GetAccountDetails_DAL(acc_BO); return(account_BO); }
override protected void OnLoad(EventArgs e) { if (!IsPostBack) { enterAddress.Visible = true; confirmAddress.Visible = false; ProcessFlow.AccountController accountController = new ProcessFlow.AccountController(); AccountInfo myAccount = accountController.GetAccountInfo(true); if (myAccount != null) { AccountBO account = new AccountBO(); billAddr.Address = account.GetAddress(myAccount.UserId); } } }