private void wdw1_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                ImageBrush myBrush = new ImageBrush();
                System.Windows.Controls.Image image = new System.Windows.Controls.Image();
                image.Source = new BitmapImage(
                    new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\Icons\\bg5.png"));
                myBrush.ImageSource = image.Source;
                //Grid grid = new Grid();
                wdw1.Background = myBrush;

                using (var ctx = new finalContext())
                {
                    FPaymentInfo fp = ctx.FPaymentInfo.Find(fId);
                    double n = 0;
                    n = fp.Amount * (fp.Loan.Service.DaifPenalty / 100);
                    lblDaif.Content = "(Fee: " + n.ToString("N2") + ")";
                    DaifFee = Double.Parse(n.ToString("N2"));
                    n = fp.Amount * (fp.Loan.Service.ClosedAccountPenalty / 100);
                    lblClosed.Content = "(Fee: " + n.ToString("N2") + ")";
                    ClosedFee = Double.Parse(n.ToString("N2"));
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         using (var ctx = new finalContext())
         {
             var set = ctx.OnlineSettings.Find(1);
             lblVisitor.Text = set.Visitor.ToString();
         }
         lblTime.Text = DateTime.Now.ToString("MMM dd, yyyy | hh:mm tt");
         Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
         Session["Service"] = null;
         Session["iService"] = null;
         if (Session["ID"] == null)
         {
             Response.Redirect("/Login.aspx");
         }
         using (var ctx = new finalContext())
         {
             int cID = Convert.ToInt32(Session["ID"]);
             var clt = ctx.Clients.Find(cID);
             lblUsername.Text = clt.Username;
         }
     }
     catch (Exception)
     {
         Response.Redirect("/Login.aspx");
     }
 }
        private void checkServices()
        {
            try
            {
                using (var ctx = new finalContext())
                {
                    string dept = "";
                    ComboBoxItem typeItem = (ComboBoxItem)cmbDept.SelectedItem;
                    string value = typeItem.Content.ToString();

                    if (value == "Both")
                        dept = "";
                    else
                        dept = value;

                    var ser = from s in ctx.Services
                              where s.Active == true && s.Department.Contains(dept)
                              select s;
                    cmbTOL.Items.Clear();
                    cmbTOL.Items.Add(new ComboBoxItem { Content = "All" });
                    foreach (var i in ser)
                    {
                        ComboBoxItem cb = new ComboBoxItem { Content = i.Name };
                        cmbTOL.Items.Add(cb);
                    }
                }
            }
            catch (Exception)
            { return; }
        }
예제 #4
0
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int sID = Convert.ToInt32(dg1.SelectedRow.Cells[1].Text);
         using (var ctx = new finalContext())
         {
             var ser = ctx.Services.Find(sID);
             double ded = ser.AgentCommission;
             var de = from d in ctx.Deductions
                      where d.ServiceID == sID
                      select d;
             foreach (var itm in de)
             {
                 ded = ded + itm.Percentage;
             }
             lblDeduction.Text = ded.ToString("N2") + "%";
             lblAmt.Text = ser.MinValue.ToString("N2") + " to " + ser.MaxValue.ToString("N2");
             lblDesc.Text = ser.Description;
             lblInt.Text = ser.Interest.ToString() + "%";
             lblTerm.Text = ser.MinTerm + " month(s) to " + ser.MaxTerm + " month(s)";
         }
     }
     catch (Exception)
     {
         Response.Redirect("/Index.aspx");
     }
 }
 public void reset()
 {
     try
     {
         using (var ctx = new finalContext())
         {
             var lon = ctx.Loans.Find(lId);
             var rmn = from rm in ctx.FPaymentInfo
                       where rm.LoanID == lId && rm.PaymentStatus == "Cleared"
                       select rm;
             double r = 0;
             foreach (var item in rmn)
             {
                 r = r + item.Amount;
             }
             double remain = lon.ReleasedLoan.TotalLoan - r;
             txtTerm.Text = lon.Term.ToString();
             txtAmt.Text = remain.ToString("N2");
             txtInt.Text = lon.Service.RestructureInterest.ToString();
             cmbMode.Text = lon.Mode;
             refresh();
         }
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
 }
        public void rg()
        {
            try
            {
                using (var ctx = new finalContext())
                {
                    var lon = ctx.Loans.Find(lID);

                    var chq = from ch in ctx.Requirements
                              where ch.ServiceID == lon.ServiceID
                              && !(from o in ctx.RequirementChecklists where o.LoanID==lID select o.RequirementId).Contains(ch.RequirementId)
                              select new { ReqNum = ch.RequirementNum, Requirement = ch.Name };
                    dg1.ItemsSource = chq.ToList();

                    var chq1 = from ch in ctx.RequirementChecklists
                               where ch.LoanID == lID
                               select new { ReqNum = ch.Requirement.RequirementNum, Requirement = ch.Requirement.Name, ConfirmedBy = ch.Employee.LastName + ", " + ch.Employee.FirstName, DateConfirmed = ch.DateConfirmed };
                    dg2.ItemsSource = chq1.ToList();
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
예제 #7
0
 private void dgEmp_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         using (var ctx = new finalContext())
         {
             img.Visibility = Visibility.Visible;
             var emp = ctx.Employees.Find(Convert.ToInt32(getRow(dgEmp, 0)));
             byte[] imageArr;
             imageArr = emp.Photo;
             BitmapImage bi = new BitmapImage();
             bi.BeginInit();
             bi.CreateOptions = BitmapCreateOptions.None;
             bi.CacheOption = BitmapCacheOption.Default;
             bi.StreamSource = new MemoryStream(imageArr);
             bi.EndInit();
             img.Source = bi;
             lblName.Content = emp.FirstName + " " + emp.MI + ". " + emp.LastName + " " + emp.Suffix;
             lblPosition.Content = "Position: " + emp.Position;
             lblDept.Content = "Department: " + emp.Department;
         }
     }
     catch (Exception ex)
     {
         //System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
 }
        private void wdw1_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                dtDate.SelectedDate = DateTime.Today.Date;
                ImageBrush myBrush = new ImageBrush();
                System.Windows.Controls.Image image = new System.Windows.Controls.Image();
                image.Source = new BitmapImage(
                    new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\Icons\\bg5.png"));
                myBrush.ImageSource = image.Source;
                //Grid grid = new Grid();
                wdw1.Background = myBrush;

                using (var ctx = new finalContext())
                {
                    var lon = ctx.Loans.Find(lId);
                    lblDesAmt.Content = "Php " + lon.LoanApplication.AmountApplied.ToString("N2");
                    lblDesTerm.Content = lon.Term.ToString();
                    txtAmt.Text = lon.LoanApplication.AmountApplied.ToString("N2");
                    if (status == "UApproval")
                    {
                        dtDate.SelectedDate = lon.ApprovedLoan.ReleaseDate;
                        txtAmt.Text = lon.ApprovedLoan.AmountApproved.ToString("N2");
                        btnApprove.Content = "Update Approval";
                    }
                    lblName.Content = lon.Client.LastName + ", " + lon.Client.FirstName + " " + lon.Client.MiddleName;
                }
                refr();
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                lblTime.Text = DateTime.Now.ToString("MMM dd, yyyy | hh:mm tt");
                Session["Service"] = null;
                Session["UpdateChecker"] = null;
                Session["iService"] = null;

                if (Session["Visit"] == null)
                {
                    Session["Visit"] = "Visited";
                    using (var ctx = new finalContext())
                    {
                        var set = ctx.OnlineSettings.Find(1);
                        set.Visitor = set.Visitor + 1;
                        ctx.SaveChanges();
                    }

                }
                using (var ctx = new finalContext())
                {
                    var set = ctx.OnlineSettings.Find(1);
                    lblDesc.Text = set.HomeDescription.Replace("\n", "<br />"); ;
                    lblVisitor.Text = set.Visitor.ToString();
                }
            }
            catch (Exception)
            {
                Response.Redirect("/Index.aspx");
            }
        }
예제 #10
0
        private void MetroWindow_Loaded_1(object sender, RoutedEventArgs e)
        {
            try
            {
                ImageBrush myBrush = new ImageBrush();
                System.Windows.Controls.Image image = new System.Windows.Controls.Image();
                image.Source = new BitmapImage(
                    new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\Icons\\bg5.png"));
                myBrush.ImageSource = image.Source;
                wdw1.Background = myBrush;

                if (status == "view")
                {
                    using (var ctx = new finalContext())
                    {
                        var u = ctx.Users.Find(eId);
                        txtUserName.Text = u.Username;
                        txtUserName.IsEnabled = false;
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
예제 #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         using (var ctx = new finalContext())
         {
             var set = ctx.OnlineSettings.Find(1);
             lblVisitor.Text = set.Visitor.ToString();
         }
         lblTime.Text = DateTime.Now.ToString("MMM dd, yyyy | hh:mm tt");
         string tnum = Request.QueryString["id"];
         using (var ctx = new finalContext())
         {
             var clt = ctx.Clients.Where(x => x.TrackingNumber == tnum).First();
             if (clt.isRegistered == true)
             {
                 Response.Redirect("/Index.aspx");
             }
             else
             {
                 clt.isRegistered = true;
                 var exp = ctx.iClientExpirations.Find(clt.ClientID);
                 lblContent.Text = "Your currently registered account will be deleted if not confirmed on or before " + exp.ExpirationDate + "\n Please visit our office to confirm this account regarding the information. Thank You.";
                 Session["newID"] = null;
                 ctx.SaveChanges();
             }
         }
     }
     catch (Exception)
     {
         Response.Redirect("/Index.aspx");
     }
 }
예제 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                using (var ctx = new finalContext())
                {
                    var set = ctx.OnlineSettings.Find(1);
                    lblVisitor.Text = set.Visitor.ToString();
                }
                lblTime.Text = DateTime.Now.ToString("MMM dd, yyyy | hh:mm tt");
                Session["Service"] = null;
                Session["iService"] = null;
                Session["UpdateChecker"] = null;
                string path = @"F:/Loan Files/Downloads/";
                List<String> lst = new List<String>();

                foreach (string s in Directory.GetFiles(path).Select(Path.GetFileName))
                    lst.Add(s);
                dg.DataSource = lst;
                dg.DataBind();
                foreach (GridViewRow row in dg.Rows)
                {
                    LinkButton lb = (LinkButton)row.Cells[0].Controls[0];
                    lb.Text = "Download";
                }
            }
            catch (Exception)
            {
                Response.Redirect("/Index.aspx");
            }
        }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                lblTime.Text = DateTime.Now.ToString("MMM dd yyyy, | hh:mm tt");
                Session["Service"] = null;
                Session["UpdateChecker"] = null;
                Session["iService"] = null;

                using (var ctx = new finalContext())
                {
                    var set = ctx.OnlineSettings.Find(1);
                    lblVisitor.Text = set.Visitor.ToString();
                }

                using(var ctx = new finalContext())
                {
                    var set = ctx.OnlineSettings.Find(1);
                    lblAbout.Text = set.AboutDescription.Replace("\n", "<br />"); ;
                    lblMission.Text = set.MissionVision.Replace("\n", "<br />"); ;
                    lblContact.Text = set.ContactInfo.Replace("\n", "<br />"); ;
                }
            }
            catch (Exception)
            {
                Response.Redirect("/Index.aspx");
            }
        }
        private void wdw1_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                ImageBrush myBrush = new ImageBrush();
                System.Windows.Controls.Image image = new System.Windows.Controls.Image();
                image.Source = new BitmapImage(
                    new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\Icons\\bg5.png"));
                myBrush.ImageSource = image.Source;
                wdw1.Background = myBrush;

                if (status == "View")
                {
                    using (var ctx = new finalContext())
                    {
                        Domain.Position pos = ctx.Positions.Find(pID);
                        txtPosition.Text = pos.PositionName;
                        txtDesc.Text = pos.Description;
                        btnSave.Content = "Save";
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
예제 #15
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         using (var ctx = new finalContext())
         {
             var ctr1 = ctx.Clients.Where(x => x.Username == txtUsername.Text && x.Password == txtPassword.Text && x.isRegistered == true).Count();
             if (ctr1 > 0)
             {
                 var clt = ctx.Clients.Where(x => x.Username == txtUsername.Text && x.Password == txtPassword.Text && x.isRegistered == true).First();
                 Session["ID"] = clt.ClientID;
                 Session["NAME"] = clt.LastName + ", " + clt.FirstName;
                 Response.Redirect("/Index.aspx");
             }
             else
             {
                 lclCheck.Visible = true;
             }
         }
     }
     catch (Exception)
     {
         Response.Redirect("/Index.aspx");
     }
 }
예제 #16
0
        private void wdw1_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                ImageBrush myBrush = new ImageBrush();
                System.Windows.Controls.Image image = new System.Windows.Controls.Image();
                image.Source = new BitmapImage(
                    new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\Icons\\bg5.png"));
                myBrush.ImageSource = image.Source;
                wdw1.Background = myBrush;
                resetGrid();

                using (var ctx = new finalContext())
                {
                    
                    var usr = ctx.Employees.Find(UserID);
                    var pos = ctx.PositionScopes.Find(usr.PositionID);
                    if (pos.UScopes == true)
                    {
                        btnScope.IsEnabled = true;
                    }
                    else
                    {
                        btnScope.IsEnabled = false;
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
예제 #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         using (var ctx = new finalContext())
         {
             var set = ctx.OnlineSettings.Find(1);
             lblVisitor.Text = set.Visitor.ToString();
         }
         lblTime.Text = DateTime.Now.ToString("MMM dd, yyyy | hh:mm tt");
         Session["UpdateChecker"] = null;
         Session["Service"] = null;
         Session["iService"] = null;
         using (var ctx = new finalContext())
         {
             var ser = from se in ctx.Services
                       where se.Active == true
                       select new { ServiceNumber = se.ServiceID, Name = se.Name, Department = se.Department, Type = se.Type };
             dg1.DataSource = ser.ToList();
             dg1.DataBind();
         }
     }
     catch (Exception)
     {
         Response.Redirect("/Index.aspx");
     }
 }
예제 #18
0
        private void reset()
        {
            using (var ctx = new finalContext())
            {
                var lon = ctx.Loans.Find(lId);
                lblName.Content = name;
                byte[] imageArr;
                imageArr = lon.Client.Photo;
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.CreateOptions = BitmapCreateOptions.None;
                bi.CacheOption = BitmapCacheOption.Default;
                bi.StreamSource = new MemoryStream(imageArr);
                bi.EndInit();
                img.Source = bi;

                lblAmt.Content = lon.ReleasedLoan.Principal.ToString("N2");
                string[] mdt = lon.ReleasedLoan.DateReleased.ToString().Split(' ');
                string d = mdt[0];
                lblDt.Content = d;
                lblMode.Content = lon.Mode;
                lblTOL.Content = lon.Service.Name;
                lblType.Content = lon.Service.Type;
                lblHF.Content = ctx.FPaymentInfo.Where(x => x.PaymentStatus.Contains("Due") && x.LoanID==lId).Count().ToString();
                var ctr = ctx.FPaymentInfo.Where(x => x.PaymentStatus == "Cleared" && x.LoanID == lId).Count();
                if (ctr > 0)
                {
                    var lst = ctx.FPaymentInfo.Where(x => x.PaymentStatus == "Cleared" && x.LoanID == lId);
                    int n = 1;
                    var str = "";
                    foreach (var itm in lst)
                    {
                        if (n == ctr)
                        {
                            str = itm.ClearCheque.DateCleared.ToString().Split(' ')[0];
                        }
                    }
                    lblLastP.Content = str;
                }
                else
                {
                    lblLastP.Content = "-";
                }
                var sm = ctx.FPaymentInfo.Where(x => x.PaymentStatus != "Cleared" && x.LoanID == lId);
                double sum = 0;
                foreach (var itm in sm)
                {
                    sum = sum + itm.Amount;
                }
                lblRemaining.Content = sum.ToString("N2");
                var sm2 = ctx.FPaymentInfo.Where(x => x.PaymentStatus.Contains("Due") && x.LoanID == lId);
                sum = 0;
                foreach (var itm in sm2)
                {
                    sum = sum + itm.Amount;
                }
                lblBal.Content = sum.ToString("N2");
            }
        }
        private void btnContinue_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MessageBoxResult mr = MessageBox.Show("Are you sure you want to proceed?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (mr == MessageBoxResult.Yes)
                {
                    if (rdDaif.IsChecked == true)
                    {
                        using (var ctx = new finalContext())
                        {
                            FPaymentInfo fp = ctx.FPaymentInfo.Find(fId);
                            ReturnedCheque rc = new ReturnedCheque { DateReturned = DateTime.Today.Date, Fee = DaifFee, FPaymentInfoID = fId, Remarks = "DAIF", isPaid = false };
                            fp.PaymentStatus = "Returned";
                            ctx.ReturnedCheques.Add(rc);

                            AuditTrail at = new AuditTrail { EmployeeID = UserID, DateAndTime = DateTime.Now, Action = "Processed returned cheque " + fp.ChequeInfo };
                            ctx.AuditTrails.Add(at);

                            ctx.SaveChanges();
                            MessageBox.Show("Okay", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                            this.Close();
                        }
                    }
                    else
                    {
                        using (var ctx = new finalContext())
                        {
                            FPaymentInfo fp = ctx.FPaymentInfo.Find(fId);
                            ClosedAccount cc = new ClosedAccount { DateClosed = DateTime.Today.Date, Fee = ClosedFee, LoanID = fp.LoanID, isPaid = false };
                            //fp.PaymentStatus = "Returned";
                            fp.Loan.Status = "Closed Account";
                            ctx.ClosedAccounts.Add(cc);

                            var chq = from c in ctx.FPaymentInfo
                                      where c.PaymentStatus != "Cleared" && c.LoanID==fp.LoanID
                                      select c;

                            foreach (var item in chq)
                            {
                                item.PaymentStatus = "Void";
                            }
                            AuditTrail at = new AuditTrail { EmployeeID = UserID, DateAndTime = DateTime.Now, Action = "Processed returned cheque " + fp.ChequeInfo };
                            ctx.AuditTrails.Add(at);

                            ctx.SaveChanges();
                            MessageBox.Show("Transaction has been successfully processed", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                            this.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtPosition.Text == "Administrator")
                {
                    System.Windows.MessageBox.Show("Administrator cannot be used as position name", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }


                if (status == "Add")
                {
                    using (var ctx = new finalContext())
                    {
                        var ctr = ctx.Positions.Where(x => x.PositionName == txtPosition.Text).Count();
                        if (ctr > 0)
                        {
                            System.Windows.MessageBox.Show("Position already exists.", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                            return;
                        }
                        Domain.Position pos = new Domain.Position { PositionName = txtPosition.Text, Description = txtDesc.Text };
                        PositionScope scp = new PositionScope { MAgent = false, MClient = false, MHoliday = false, MBank = false, MEmployee = false, MPosition = false, MRegistration = false, MService = false, TApplication = false, TApproval = false, TCollection = false, TManageClosed = false, TOnlineConfirmation = false, TPaymentAdjustment = false, TPayments = false, TReleasing = false, TResturcture = false, UArchive = false, UBackUp = false, UOnlineSettings = false, UReports = false, UScopes = false, UStatistics = false, UUserAccounts = false };
                        ctx.Positions.Add(pos);


                        AuditTrail at = new AuditTrail { EmployeeID = UserID, DateAndTime = DateTime.Now, Action = "Added new Position " + txtPosition.Text };
                        ctx.AuditTrails.Add(at);

                        ctx.SaveChanges();
                        scp.PositionID = pos.PositionID;
                        ctx.PositionScopes.Add(scp);
                        ctx.SaveChanges();
                        System.Windows.MessageBox.Show("Record has been successfully added", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                        this.Close();
                    }
                }
                else
                {
                    using (var ctx = new finalContext())
                    {
                        Domain.Position pos = ctx.Positions.Find(pID);
                        pos.PositionName = txtPosition.Text;
                        pos.Description = txtDesc.Text;
                        AuditTrail at = new AuditTrail { EmployeeID = UserID, DateAndTime = DateTime.Now, Action = "Updated Position " + txtPosition.Text };
                        ctx.AuditTrails.Add(at);
                        ctx.SaveChanges();
                        System.Windows.MessageBox.Show("Record has been successfully updated", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
        public void reset()
        {
            try
            {
                using (var ctx = new finalContext())
                {
                    var lon = ctx.Loans.Find(lID);
                    myNum = ctx.CollateralInformations.Where(x => x.ServiceID == lon.ServiceID).Count();

                    textarray = new TextBox[myNum];
                    labelarray = new Label[myNum];
                    string[] myStr = new string[myNum];
                    StackPanel[] sp = new StackPanel[myNum];
                    stck.Children.Clear();
                    int ictr = 0;
                    var f = from x in ctx.CollateralInformations
                            where x.ServiceID == lon.ServiceID
                            select x;
                    foreach(var item in f)
                    {
                        labelarray[ictr] = new Label();
                        labelarray[ictr].Height = 30;
                        //labelarray[ctr].Width = 50;
                        labelarray[ictr].FontSize = 16;
                        //labelarray[ctr].Content = "Cheque No. " + (ctr + 1).ToString();
                        textarray[ictr] = new TextBox();
                        textarray[ictr].Height = 25;
                        textarray[ictr].Width = 300;
                        textarray[ictr].FontSize = 16;
                        textarray[ictr].MaxLength = 6;
                        sp[ictr] = new StackPanel();
                        sp[ictr].Width = 300;
                        sp[ictr].Height = 60;
                        sp[ictr].Children.Add(labelarray[ictr]);
                        sp[ictr].Children.Add(textarray[ictr]);
                        stck.Children.Add(sp[ictr]);
                        labelarray[ictr].Content = item.Field + ":";
                        myStr[ictr] = item.Field;
                        ictr++;
                    }
                    for (int ctr = 0; ctr < myNum; ctr++)
                    {
                        string str = myStr[ctr];
                        var cn = ctx.CollateralLoanInfoes.Where(x => x.LoanID == lID && x.CollateralInformation.Field == str).Count();
                        if (cn > 0)
                        {
                            var c = ctx.CollateralLoanInfoes.Where(x => x.LoanID == lID && x.CollateralInformation.Field == str).First();
                            textarray[ctr].Text = c.Value;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
예제 #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (var ctx = new finalContext())
     {
         var set = ctx.OnlineSettings.Find(1);
         lblVisitor.Text = set.Visitor.ToString();
     }
     lblTime.Text = DateTime.Now.ToString("MMM dd, yyyy | hh:mm tt");
 }
예제 #23
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtPassword.Password != txtConfirm.Password)
                {
                    MessageBox.Show("Password doesn't match", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                    txtPassword.Password = "";
                    txtConfirm.Password = "";
                    return;
                }
                if (status != "view")
                {
                    using (var ctx = new finalContext())
                    {
                        var u = ctx.Users.Where(x => x.Username == txtUserName.Text).Count();
                        if (u > 0)
                        {
                            MessageBox.Show("Username already exists", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                            txtUserName.Text = "";
                            return;
                        }

                        User usr = new User { EmployeeID = eId, Username = txtUserName.Text, Password = txtPassword.Password };
                        Scope sc = new Scope { EmployeeID = eId };
                        ctx.Users.Add(usr);
                        ctx.Scopes.Add(sc);

                        AuditTrail at = new AuditTrail { EmployeeID = UserID, DateAndTime = DateTime.Now, Action = "Added new User Account " + txtUserName.Text };
                        ctx.AuditTrails.Add(at);

                        ctx.SaveChanges();
                        MessageBox.Show("User has been successfully added", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                        this.Close();
                    }
                }
                else
                {
                    using (var ctx = new finalContext())
                    {
                        var u = ctx.Users.Find(eId);
                        u.Password = txtPassword.Password;
                        AuditTrail at = new AuditTrail { EmployeeID = UserID, DateAndTime = DateTime.Now, Action = "Updated User Account " + txtUserName.Text };
                        ctx.AuditTrails.Add(at);
                        ctx.SaveChanges();
                        MessageBox.Show("User has been successfully updated", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
예제 #24
0
 private void rg()
 {
     using (var ctx = new finalContext())
     {
         var adt = from ad in ctx.AuditTrails
                   where ad.DateAndTime >= dt.SelectedDate 
                   select new { Action = ad.Employee.FirstName + " " + ad.Employee.MI + " " + ad.Employee.LastName + " -> " + ad.Action, DateAndTime = ad.DateAndTime};
         dg.ItemsSource = adt.ToList().OrderByDescending(x=> x.DateAndTime);
     }
 }
예제 #25
0
        private void refresh()
        {
            try
            {
                if (status == "UReleasing")
                {
                    using (var ctx = new finalContext())
                    {
                        var lons = from ge in ctx.FPaymentInfo
                                   where ge.LoanID == lId
                                   select ge;
                        myNum = ctx.FPaymentInfo.Where(x => x.LoanID == lId).Count();
                    }
                }

                textarray = new System.Windows.Controls.TextBox[myNum];
                System.Windows.Controls.Label[] labelarray = new System.Windows.Controls.Label[myNum];
                StackPanel[] sp = new StackPanel[myNum];
                stck.Children.Clear();
                for (int ctr = 0; ctr < myNum; ctr++)
                {
                    labelarray[ctr] = new System.Windows.Controls.Label();
                    labelarray[ctr].Height = 30;
                    //labelarray[ctr].Width = 50;
                    labelarray[ctr].FontSize = 16;
                    labelarray[ctr].Content = "Cheque No. " + (ctr + 1).ToString();
                    textarray[ctr] = new System.Windows.Controls.TextBox();
                    textarray[ctr].Height = 25;
                    textarray[ctr].Width = 300;
                    textarray[ctr].FontSize = 16;
                    textarray[ctr].MaxLength = 6;
                    sp[ctr] = new StackPanel();
                    sp[ctr].Width = 300;
                    sp[ctr].Height = 60;
                    sp[ctr].Children.Add(labelarray[ctr]);
                    sp[ctr].Children.Add(textarray[ctr]);
                    stck.Children.Add(sp[ctr]);
                    if (status == "Releasing" || status == "Renewal")
                    {
                        if (ctr == 0)
                        {
                            textarray[0].LostFocus += new RoutedEventHandler(txt_LostFocus);   
                        }
                    }

                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

        }
예제 #26
0
 private void btnAdjust_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dtTo.SelectedDate.Value.Date < dtFrom.SelectedDate.Value.Date)
         {
             System.Windows.MessageBox.Show("TO date must be breater than or equal to FROM date", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         using (var ctx = new finalContext())
         {
             var py = from p in ctx.MPaymentInfoes
                      where (p.DueDate <= dtTo.SelectedDate.Value && p.DueDate >= dtFrom.SelectedDate.Value) && (p.PaymentStatus == "Unpaid" || p.PaymentStatus=="Pending")
                      select p;
             var ctr = ctx.MPaymentInfoes.Where(p=> (p.DueDate <= dtTo.SelectedDate.Value && p.DueDate >= dtFrom.SelectedDate.Value) && (p.PaymentStatus == "Unpaid" || p.PaymentStatus == "Pending")).Count();
             if (ctr > 0)
             {
                 var ps = ctx.MPaymentInfoes.Where(p=> (p.DueDate <= dtTo.SelectedDate.Value && p.DueDate >= dtFrom.SelectedDate.Value) && (p.PaymentStatus == "Unpaid" || p.PaymentStatus == "Pending")).First();
                 double rem = ps.RemainingLoanBalance;
                 foreach (var itm in py)
                 {
                     itm.TotalAmount = itm.Amount + itm.PreviousBalance;
                     itm.TotalBalance = itm.TotalBalance - itm.BalanceInterest;
                     itm.RemainingLoanBalance = rem;
                     //if (itm.BalanceInterest != 0)
                     //{
                     //itm.PreviousBalance = itm.PreviousBalance - itm.BalanceInterest;
                     //itm.TotalAmount = itm.Amount + itm.PreviousBalance;
                     //}
                     if (itm.PaymentStatus == "Unpaid")
                     {
                         itm.PaymentStatus = "Unpaid(No Interest)";
                     }
                 }
                 foreach (var itm in py)
                 {
                     itm.BalanceInterest = 0;
                 }
                 MicroAdjusment ma = new MicroAdjusment { ToDate = dtTo.SelectedDate.Value.Date, FromDate = dtFrom.SelectedDate.Value.Date, ReasonOfAdjustment = txtReason.Text };
                 ctx.MicroAdjusments.Add(ma);
                 ctx.SaveChanges();
                 System.Windows.MessageBox.Show("Transaction has been  successfully processed", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                 this.Close();
             }
         }
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
 }
예제 #27
0
        private void wdw1_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                ImageBrush myBrush = new ImageBrush();
                System.Windows.Controls.Image image = new System.Windows.Controls.Image();
                image.Source = new BitmapImage(
                    new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\Icons\\bg5.png"));
                myBrush.ImageSource = image.Source;
                wdw1.Background = myBrush;

                using (var ctx = new finalContext())
                {
                    var sc = ctx.PositionScopes.Find(ID);
                    cClient.IsChecked = sc.MClient;
                    cAgents.IsChecked = sc.MAgent;
                    cServices.IsChecked = sc.MService;
                    cBanks.IsChecked = sc.MBank;
                    cEmployee.IsChecked = sc.MEmployee;
                    cPosition.IsChecked = sc.MPosition;
                    cHoliday.IsChecked = sc.MHoliday;
                    cOnlineReg.IsChecked = sc.MRegistration;

                    cApplication.IsChecked = sc.TApplication;
                    cApproval.IsChecked = sc.TApproval;
                    cReleasing.IsChecked = sc.TReleasing;
                    cPayments.IsChecked = sc.TPayments;
                    cManageClosed.IsChecked = sc.TManageClosed;
                    cRestructure.IsChecked = sc.TResturcture;
                    cAdjustment.IsChecked = sc.TPaymentAdjustment;
                    cOnlineApp.IsChecked = sc.TOnlineConfirmation;
                    cCollection.IsChecked = sc.TCollection;
                    cRenewal.IsChecked = sc.TRenewal;

                    cArchive.IsChecked = sc.UArchive;
                    cBackup.IsChecked = sc.UBackUp;
                    cUsers.IsChecked = sc.UUserAccounts;
                    cReports.IsChecked = sc.UReports;
                    cStatistics.IsChecked = sc.UStatistics;
                    cUserScopes.IsChecked = sc.UScopes;
                    cOnlineSettings.IsChecked = sc.UOnlineSettings;
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
예제 #28
0
        private void txtID_TextChanged(object sender, TextChangedEventArgs e)
        {
            int lID;
            try
            {
                lID = Convert.ToInt32(txtID.Text);
            }
            catch (Exception)
            {
                lID = 0;
            }
            try
            {
                using (var ctx = new finalContext())
                {
                    var ctr = ctx.Loans.Where(x => x.LoanID == lID && x.Status == "Under Collection").Count();
                    if (ctr > 0)
                    {
                        txtAmt.IsEnabled = !false;
                        btnRecord.IsEnabled = !false;

                        var lon = ctx.Loans.Find(lID);

                        lblClient.Content = lon.Client.LastName + ", " + lon.Client.FirstName + " " + lon.Client.MiddleName + " " + lon.Client.Suffix;

                        lblTOL.Content = lon.Service.Name;

                        var mp = ctx.PassedToCollectors.Where(x => x.LoanID == lID).First();

                        lblTotalLoan.Content = mp.RemainingBalance.ToString("N2");


                    }
                    else
                    {
                        txtAmt.IsEnabled = false;
                        btnRecord.IsEnabled = false;
                        txtAmt.Text = "";
                        lblClient.Content = "";
                        lblTOL.Content = "";
                        lblTotalLoan.Content = "";
                    }
                }
            }
            catch (Exception ex)
            {

            }
        }
 public void rg()
 {
     try
     {
         using (var ctx = new finalContext())
         {
             if (rdAdd.IsChecked == true)
             {
                 var ads = from ad in ctx.HomeAddresses
                           where ad.ClientID == cID
                           select new { No = ad.AddressNumber, Street = ad.Street, Province = ad.Province, City = ad.City, OwnershipType = ad.OwnershipType, MonthlyFee = ad.MonthlyFee, LengthOfStay = ad.LengthOfStay };
                 dgAddCon.ItemsSource = ads.ToList();
             }
             else if (rdCon.IsChecked == true)
             {
                 var cts = from ct in ctx.ClientContacts
                           where ct.ClientID == cID
                           select new { No = ct.ContactNumber, Contact = ct.Contact, Primary = ct.Primary };
                 dgAddCon.ItemsSource =  cts.ToList();
             }
             else if (rdDep.IsChecked == true)
             {
                 var dps = from td in ctx.Dependents
                           where td.ClientID == cID
                           select new { No = td.DependentNumber, LastName = td.LastName, FirstName = td.FirstName, MiddleName = td.MiddleName, Suffix = td.Suffix, Birthday = td.Birthday, School = td.School };
                 dgAddCon.ItemsSource = dps.ToList();
             }
             else if (rdWorks.IsChecked == true)
             {
                 var wrk = from wr in ctx.Works
                           where wr.ClientID == cID
                           select new { No = wr.WorkNumber, BusinessName = wr.BusinessName, DTI = wr.DTI, Street = wr.Street, Province = wr.Province, City = wr.City, Employment = wr.Employment, LengthOfStay = wr.LengthOfStay, BusinessNumber = wr.BusinessNumber, Position = wr.Position, MonthlyIncome = wr.MonthlyIncome, PLNumber = wr.PLNumber, Status = wr.status };
                 dgAddCon.ItemsSource = wrk.ToList();
             }
             else if (rdRef.IsChecked == true)
             {
                 var rfs = from rf in ctx.References
                           where rf.ClientID == cID
                           select new { No = rf.ReferenceNumber, LastName = rf.LastName, FirstName = rf.FirstName, MI = rf.MiddleName, Suffix = rf.Suffix, Street = rf.Street, Province = rf.Province, City = rf.City, Contact = rf.Contact };
                 dgAddCon.ItemsSource = rfs.ToList();
             }
         }
     }
     catch (Exception ex)
     {
         //System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
 }
예제 #30
0
 public void resetGrid()
 {
     try
     {
         using (var ctx = new finalContext())
         {
             var emp = from em in ctx.Employees where em.Active == status select new { em.EmployeeID, em.FirstName, em.MI, em.LastName, em.Suffix, em.Position.PositionName };
             dgEmp.ItemsSource = emp.ToList();
         }
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show("Runtime Error: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
 }