コード例 #1
0
        }// DeleteProduct()

        public bool AddProduct(ViewModel.ClassStudent displayP)
        {
            hasError = false;
            try
            {
                //double mynum;
                //if (displayP.TuitionDiscount.HasValue)
                //    ;
                //else
                //    displayP.TuitionDiscount = null;
                SqlClassStudent         p  = new SqlClassStudent(displayP);
                DataClasses1DataContext dc = new DataClasses1DataContext();
                int?newId = 0;

                dc.AddCS(p.StudentId, p.ClassId, p.TuitionPaid, p.Comment,
                         p.InvoiceNumber, p.CasherName, p.CashReceived, p.CheckReceived, p.CheckNumber, p.CreditCardReceived, p.OtherReceived, p.OtherSource, p.RegistrationDate, ref newId);
                p.Id = (int)newId;
                displayP.ProductAdded2DB(p);    //update corresponding ClassStudent Id using SqlClassStudent
            }
            catch (Exception ex)
            {
                errorMessage = "Add error, " + ex.Message;
                hasError     = true;
                log.Error("In StoreDB..AddProduct: " + ex.StackTrace);
            }
            return(!hasError);
        } //AddProduct()
コード例 #2
0
        } //GetProducts()

        public bool UpdateProduct(ViewModel.ClassStudent displayP)
        {
            try
            {
                SqlClassStudent         p  = new SqlClassStudent(displayP);
                DataClasses1DataContext dc = new DataClasses1DataContext();
                dc.UpdateCS(p.Id, p.StudentId, p.ClassId, p.TuitionPaid, p.Comment,
                            p.InvoiceNumber, p.CasherName, p.CashReceived, p.CheckReceived, p.CheckNumber, p.CreditCardReceived, p.OtherReceived, p.OtherSource, p.RegistrationDate);
            }
            catch (Exception ex)
            {
                errorMessage = "Update error, " + ex.Message;
                hasError     = true;
                log.Error("In StoreDB..UpdateProduct: " + ex.StackTrace);
            }
            return(!hasError);
        } //UpdateProduct()