Exemple #1
0
        } //ChkProductForAdd()

        //check all product fields for validity
        public bool ChkProductForUpdate(ClassStudent p)
        {
            int errCnt = 0;

            if (String.IsNullOrEmpty(p.ClassName))
            {
                errCnt++; ModelNumberBrush = errorBrush;
            }
            else
            {
                ModelNumberBrush = okBrush;
            }
            if (String.IsNullOrEmpty(p.StudentName))
            {
                errCnt++; ModelNameBrush = errorBrush;
            }
            else
            {
                ModelNameBrush = okBrush;
            }

            if (errCnt == 0)
            {
                Status = "OK"; return(true);
            }
            else
            {
                Status = "Update, missing or invalid fields."; return(false);
            }
        } //ChkProductForUpdate()
Exemple #2
0
 private void UpdateProduct(ClassStudent p)
 {
     if (selectedProduct != null)
     {
         int index = dataItems.IndexOf(selectedProduct);
         if (index > -1)
         {
             dataItems.ReplaceItem(index, p);
             SelectedProduct = p;
         }
         else
         {
             Console.WriteLine("Index out of boundry " + selectedProduct.Grouping);
         }
     }
 }
 private void ClearClassStudentDisplay()
 {
     //App.last_action = "Clear"; Clear is always appended to other major Actions
     isSelected = false;
     stat.NoError();
     if (DisplayedProduct != null && DisplayedProduct.ClassId == null && DisplayedProduct.StudentId == null)
     {
         log.Info("In ClearClassStudentDisplay: No need to create a new ClassStudent()");
     }
     else
     {
         DisplayedProduct = new ClassStudent();
         log.Info("ClearClassStudentDisplay() invokes DisplayedProduct = new ClassStudent()");
     }
     App.Messenger.NotifyColleagues("ProductCleared");
     ///MainWindowViewModel.Instance.StatusBar = $"Screen Cleared";
 } //ClearProductDisplay()
 private void GetClassStudent()
 {
     App.last_action = "Refresh";
     isSelected      = false;
     stat.NoError();
     if (DisplayedProduct != null && DisplayedProduct.ClassId == null && DisplayedProduct.StudentId == null)
     {
         log.Info("In GetClassStudent: No need to create a new ClassStudent()");
     }
     else
     {
         DisplayedProduct = new ClassStudent();
         log.Info("GetClassStudent() invokes DisplayedProduct = new ClassStudent()");
     }
     App.Messenger.NotifyColleagues("GetClassStudents");
     MainWindowViewModel.Instance.StatusBar = $"DB Refreshed";
 }
Exemple #5
0
 public SqlClassStudent(ClassStudent p)
 {
     Id                 = p.ID;
     StudentId          = p.StudentId;
     ClassId            = p.ClassId;
     TuitionPaid        = p.TuitionPaid;
     Comment            = p.Comment;
     UpdateDateTime     = p.UpdateDateTime;
     InvoiceNumber      = p.InvoiceNumber;
     CasherName         = p.CasherName;
     CashReceived       = p.CashReceived;
     CheckReceived      = p.CheckReceived;
     CheckNumber        = p.CheckNumber;
     CreditCardReceived = p.CreditCardReceived;
     OtherReceived      = p.OtherReceived;
     OtherSource        = p.OtherSource;
     RegistrationDate   = p.RegistrationDate;
     //TuitionDiscount = p.TuitionDiscount;
 }
        } //AddProduct()

        public void ProcessProduct(ClassStudent p)
        {
            log.Info("CSDisplayViewModel..ProcessProduct starts");
            //Delete will trigger SelectionChanged, So SelectionChanged is ambigous, let's disable this flag to remove abiguity
            //App.last_action = "SelectionChanged";
            if (p == null)
            {
                /*DisplayedProduct = null;*/
                isSelected = false;
                return;
            }
            //Deep copy to seperate DisplayVM..DisplayedProduct and CSViewModel..SelectedProduct; Each has its own context
            //but after testing, we dont need to do a deep copy, it still works
            ///ClassStudent temp = new ClassStudent();
            ///temp.CopyProduct(p);
            //DisplayedProduct = temp;
            DisplayedProduct = p;

            isSelected = true;
            stat.NoError();
            MainWindowViewModel.Instance.StatusBar = $"Record selection changed";
            log.Info("CSDisplayViewModel..ProcessProduct End");
        } // ProcessProduct()
Exemple #7
0
 private void AddProduct(ClassStudent p)
 {
     //No need for deep copy
     DataItems.Add(p);
     //RefreshCustomerView();
 }