protected void Save_Click(object sender, RoutedEventArgs e) { if (CheckForError(Loan) || CheckForError(Collection) || CheckForError(Installment)) { MessageBox.Show("Error!Check Input Again"); return; } int id = Convert.ToInt32(EntryNo.Text); string collection = Collection.Text; string collector = Collector.Text; string loan = Loan.Text; DateTime nextDate = Convert.ToDateTime(NextDate.Text); double balance = Convert.ToDouble(Balance.Text); string installment = Installment.Text; LoanLedger query = new LoanLedger(); if ((string)Save.Content == "Insert") { query.InsertTable(collection, method, collector, loan, installment, balance, nextDate, id, sender, e); } else { query.UpdateTable(collection, method, collector, loan, installment, balance, nextDate, id, sender, e); Save.Content = "Insert"; } LoanLedger data = new LoanLedger(); int tempId = Convert.ToInt32(Loan.Text); DailyLedger.ItemsSource = data.GetDataIndividual(method, tempId, 2); DataContext = data; }
public DailyLedgerView() { InitializeComponent(); LoanLedger data = new LoanLedger(); DailyLedger.ItemsSource = data.GetDataIndividual(method, 0, 0); DataContext = data; }
private void Loan_LostFocus(object sender, RoutedEventArgs e) { LoanLedger data = new LoanLedger(); int tempId = Convert.ToInt32(Loan.Text); DailyLedger.ItemsSource = data.GetDataIndividual(method, tempId, 2); DataContext = data; }
private void Next_Click(object sender, RoutedEventArgs e) { LoanLedger data = new LoanLedger(); int tempId = Convert.ToInt32(Loan.Text); WeeklyLedger.ItemsSource = data.GetDataIndividual(method, tempId, 1); DataContext = data; }
private void Remove_Click(object sender, RoutedEventArgs e) { RemoveDialogView handle = new RemoveDialogView(); if (handle.ShowDialog() == true) { using (SqlConnection con = new SqlConnection(@Connection.ConnectionString)) { if (handle.FirstInput != handle.SecondInput) { MessageBox.Show("Entry No. did not match.Try again.\n", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } Connection conn = new Connection(); conn.OpenConection(); int isLogin = 0; string query = "SELECT * From Stuff "; SqlDataReader reader = conn.DataReader(query); while (reader.Read()) { stuff_name = (string)reader["Stuff_Name"]; stuff_pass = (string)reader["Stuff_Password"]; if (stuff_name.Equals(Login.GlobalStuffName) && stuff_pass.Equals(handle.GetPassword)) { isLogin = 1; break; } } if (isLogin != 1) { MessageBox.Show("Wrong Password.Try again.\n", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } using (SqlCommand command = new SqlCommand("DELETE FROM LoanCollection WHERE LoanCollection_Id = " + handle.FirstInput, con)) { con.Open(); command.ExecuteNonQuery(); con.Close(); } Id = Convert.ToInt32(handle.FirstInput); dateTime = (DateTime)Login.GlobalDate; string table = "Loan Collection Ledger"; string type = "Removed"; string color = "Red"; EntryLog entry = new EntryLog(); entry.Add_Entry(table, type, Id, dateTime, color); conn.CloseConnection(); LoanLedger data = new LoanLedger(); int tempId = Convert.ToInt32(Loan.Text); DailyLedger.ItemsSource = data.GetDataIndividual(method, tempId, 2); DataContext = data; } } }
public MonthlyDueView() { InitializeComponent(); DueModel data = new DueModel(); dueDetails.ItemsSource = data.GetData(method); DataContext = data; LoanLedger data2 = new LoanLedger(); MonthlyLedger.ItemsSource = data2.GetData(method); DataContext = data2; }
protected void Save_Click(object sender, RoutedEventArgs e) { Connection conn = new Connection(); conn.OpenConection(); int isLogin = 0; string query = "SELECT * From Stuff ";//WHERE Stuff_Cell = 12345"; SqlDataReader reader = conn.DataReader(query); while (reader.Read()) { stuff_name = (string)reader["Stuff_Name"]; stuff_cell = (String)reader["Stuff_Cell"]; stuff_pass = (String)reader["Stuff_Password"]; if (stuff_cell.Equals(Cell.Text) && stuff_pass.Equals(Passwordbox.Password)) { isLogin = 1; break; } } if (isLogin != 1) { //Console.Write("logged_out" + stuff_cell + " go" + Cell.Text + " " + stuff_pass + " " + Password.Text+" "+SelectedDate); MessageBox.Show("Sorry! Wrong Password!!!"); } conn.CloseConnection(); if (isLogin == 1) { //Console.Write("logged_in" + stuff_cell + " " + Cell.Text + " " + stuff_pass + " " + Password.Text+" "+SelectedDate); new Login().SetStuffName(stuff_name); MainWindow main = new MainWindow(); App.Current.MainWindow = main; this.Close(); main.Show(); LoanLedger Due = new LoanLedger(); Due.DueChecker(); } }
public ActionResult uploaddata(LoginViewModel lvm, FormCollection form) { try { UvlotAEntities db = new UvlotAEntities(); //string refNumber = MyUtility.GenerateRefNo(); DataTable dt = (DataTable)Session["myDtVal"]; DataReader dr = new DataReader(); GetMenus(); foreach (DataRow row in dt.Rows) { try { // LoanApplication inst = new LoanApplication(); if (row["SURNAME"] != null) { if (row["SURNAME"].ToString().Length < 2 && row["FIRST NAME"].ToString().Length < 2) { break; } } LoanApplication instObj = new LoanApplication(); instObj.AccomodationType_FK = dr.GetAccomType(row["ACCOMMODATION TYPE"].ToString()); instObj.AccountName = row["ACCOUNT NAME"].ToString(); instObj.AccountNumber = row["ACCOUNT NUMBER"].ToString(); instObj.ApplicantID = row["MEANS OF ID"].ToString(); instObj.ApplicationStatus_FK = 3;//Pending status, instObj.BVN = row["BANK VERIFICATION NUMBER"].ToString(); instObj.ClosestBusStop = row["CLOSEST BUSTOP"].ToString(); string DOB = row["DATE OF BIRTH"].ToString(); instObj.ContactAddress = row["HOME ADDRESS"].ToString(); instObj.CreatedBy = ""; //Change To User ID instObj.DateCreated = MyUtility.getCurrentLocalDateTime(); instObj.DateModified = MyUtility.getCurrentLocalDateTime(); instObj.DateOfBirth = DOB;// Helper.isDate(DOB) == true ? Convert.ToDateTime(DOB) : MyUtility.getCurrentLocalDateTime(); instObj.EmailAddress = row["PERSONAL EMAIL"].ToString(); instObj.ExistingLoan = row["ANY EXISTING LOAN"].ToString().ToUpper() == "YES" ? true : false; instObj.ExistingLoan_NoOfMonthsLeft = 0; instObj.ExistingLoan_OutstandingAmount = 0; instObj.Firstname = row["FIRST NAME"].ToString(); instObj.Gender_FK = row["GENDER"].ToString().ToUpper() == "MALE" ? 1 : 2; instObj.IdentficationNumber = row["IDENTIFICATION NUMBER"].ToString(); instObj.Landmark = row["LANDMARK"].ToString(); instObj.LGA_FK = dr.GetLocalGovt(row["LGA"].ToString()); instObj.LoanAmount = Convert.ToDouble(row["LOAN AMOUNT"]); instObj.LoanComment = ""; instObj.LoanRefNumber = MyUtility.GenerateRefNo(); instObj.MaritalStatus_FK = dr.GetStatus(row["MARITAL STATUS"].ToString()); instObj.BankCode = Convert.ToString(dr.GetBankCode(row["BANK NAME"].ToString().Trim())); instObj.MeansOfID_FK = dr.GetMeansofIdbyname(row["MEANS OF ID"].ToString()); instObj.NOK_EmailAddress = row["NOK_EMAIL ADDRESS"].ToString(); instObj.NOK_FullName = row["NOK_NAME"].ToString(); instObj.NOK_HomeAddress = row["NOK_HOME ADDRESS"].ToString(); instObj.NOK_PhoneNumber = row["NOK_PHONE"].ToString(); instObj.NOK_Relationship = row["NOK_RELATIONSHIP"].ToString(); instObj.Organization = row["EMPLOYER"].ToString(); instObj.Othernames = ""; instObj.PhoneNumber = row["MOBILE NUMBER"].ToString(); instObj.Institution_FK = dr.GetInstitution(row["INSTITUTION"].ToString()); instObj.RepaymentMethod_FK = 0; instObj.StateofResidence_FK = dr.GetState(row["STATE OF RESIDENCE"].ToString()); instObj.Surname = row["SURNAME"].ToString(); instObj.Title_FK = dr.GetTitleIDByName(row["TITLE"].ToString()); instObj.IsVisible = 1; instObj.ValueDate = MyUtility.getCurrentLocalDateTime().ToString("yyyy/MM/dd"); instObj.ValueTime = MyUtility.getCurrentLocalDateTime().ToString("H:mmss"); db.LoanApplications.Add(instObj); db.SaveChanges(); EmployerLoanDetail empObj = new EmployerLoanDetail(); empObj.ClosestBusStop = row["CLOSEST BUSTOP"].ToString(); empObj.DateCreated = MyUtility.getCurrentLocalDateTime(); empObj.DateModified = MyUtility.getCurrentLocalDateTime(); empObj.Department = row["DEPARTMENT"].ToString(); empObj.Designation = row["DESIGNATION"].ToString(); empObj.EmployerID = row["EMPLOYEE ID"].ToString(); empObj.EmploymentStatus_FK = dr.GetEmpoStatus(row["EMPLOYMENT STATUS"].ToString()); empObj.IsVisible = 1; empObj.LandMark = row["LANDMARK"].ToString(); var loss = row["LENGTH OF SERVICE WITH CURRENT EMPLOYER"].ToString(); int los = Helper.isNumeric(loss) == true?Convert.ToInt16(loss) : 0; empObj.LengthOfServiceInMth = los; empObj.LGA_FK = row["LGA"].ToString(); empObj.NetMonthlyIncome = Convert.ToDouble(row["NET MONTHLY INCOME"]); empObj.Occupation = row["OCCUPATION"].ToString(); empObj.OfficialEmailAddress = row["EMAIL"].ToString(); empObj.ValueDate = MyUtility.getCurrentLocalDateTime().ToString("yyyy/MM/dd"); empObj.ValueTime = MyUtility.getCurrentLocalDateTime().ToString("H:mmss"); empObj.LoanApplication_FK = instObj.ID; db.EmployerLoanDetails.Add(empObj); db.SaveChanges(); LoanLedger lonObj = new LoanLedger(); lonObj.ApplicantID = row["EMPLOYEE ID"].ToString(); lonObj.Credit = 0; lonObj.Debit = 0; lonObj.Institution_FK = instObj.Institution_FK; lonObj.IsVisible = 1; lonObj.LastUpdated = MyUtility.getCurrentLocalDateTime(); lonObj.RefNumber = instObj.LoanRefNumber; lonObj.PartnerRefNumber = ""; lonObj.TranxDate = MyUtility.getCurrentLocalDateTime(); lonObj.ValueDate = MyUtility.getCurrentLocalDateTime().ToString("yyyy/MM/dd"); lonObj.ValueTime = MyUtility.getCurrentLocalDateTime().ToString("H:mmss"); db.LoanLedgers.Add(lonObj); db.SaveChanges(); //DataWriter.CreateLoanApplication(instObj); } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { Exception raise = dbEx; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { string message = string.Format("{0}:{1}", validationErrors.Entry.Entity.ToString(), validationError.ErrorMessage); //raise a new exception inserting the current one as the InnerException raise = new InvalidOperationException(message, raise); } } WebLog.Log(raise); } } } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { Exception raise = dbEx; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { string message = string.Format("{0}:{1}", validationErrors.Entry.Entity.ToString(), validationError.ErrorMessage); //raise a new exception inserting the current one as the InnerException raise = new InvalidOperationException(message, raise); } } WebLog.Log(raise); } return(View("ImportExcel1")); }