コード例 #1
0
        public static List <OurCustomer> List()
        {
            List <OurCustomer> OurCustomerList = new List <OurCustomer>();
            SqlConnection      connection      = OnlineSales2Data.GetConnection();
            string             selectStatement
                = "SELECT "
                  + "     [UserId] "
                  + "FROM "
                  + "     [OurCustomer] "
                  + "";
            SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

            try
            {
                connection.Open();
                SqlDataReader reader      = selectCommand.ExecuteReader();
                OurCustomer   OurCustomer = new OurCustomer();
                while (reader.Read())
                {
                    OurCustomer        = new OurCustomer();
                    OurCustomer.UserId = System.Convert.ToInt32(reader["UserId"]);
                    OurCustomerList.Add(OurCustomer);
                }
                reader.Close();
            }
            catch (SqlException)
            {
                return(OurCustomerList);
            }
            finally
            {
                connection.Close();
            }
            return(OurCustomerList);
        }
コード例 #2
0
        public void test()
        {
            var ourCustomer = new OurCustomer("Sheen", "Dayal");
            var adapter     = new CustomerAdapter();
            var customer    = adapter.ConvertToCustomer(ourCustomer);

            var adaptorInterface = new CustomerAdapter2();

            customer = adaptorInterface.Convert(ourCustomer);
        }
コード例 #3
0
        public ActionResult Edit([Bind(Include =
                                           " UserId"
                                           + ",QbCustomerId"
                                           + ",QuickbooksAccessToken"
                                           + ",QuickbooksSecretToken"
                                           + ",QbSalesAccount"
                                           + ",QbSalesTax"
                                           + ",QbSalesDiscounts"
                                           + ",QbFreightIncome"
                                           + ",QbCash"
                                           + ",QbCostOfGoods"
                                           + ",QbUndepositiedFunds"
                                           + ",QbSalesId"
                                           + ",QbSalesTaxId"
                                           + ",QbDiscountsId"
                                           + ",QbFreightId"
                                           + ",QbCashId"
                                           + ",QbCostofGoodsId"
                                           + ",QbUndepositedFundsId"
                                       )] OurCustomer OurCustomer)
        {
            OurCustomer oOurCustomer = new OurCustomer();

            oOurCustomer.UserId = System.Convert.ToInt32(OurCustomer.UserId);
            oOurCustomer        = OurCustomerData.Select_Record(OurCustomer);

            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = OurCustomerData.Update(oOurCustomer, OurCustomer);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Update");
                }
            }

            return(View(OurCustomer));
        }
コード例 #4
0
            public OurCustomer AddOurCustomer(System.Guid CustomerID, string FirstName, string LastName, string MiddleName, string Address, string Apartment, string City, string State, string Zip, string HomePhone, string BusinessPhone, string FullName)
            {
                OurCustomer rowOurCustomer = ((OurCustomer)(this.NewRow()));

                rowOurCustomer.ItemArray = new object[] {
                    CustomerID,
                    FirstName,
                    LastName,
                    MiddleName,
                    Address,
                    Apartment,
                    City,
                    State,
                    Zip,
                    HomePhone,
                    BusinessPhone,
                    FullName
                };
                this.Rows.Add(rowOurCustomer);
                return(rowOurCustomer);
            }
コード例 #5
0
        public ActionResult DeleteConfirmed(
            Int32?UserId
            )
        {
            OurCustomer OurCustomer = new OurCustomer();

            OurCustomer.UserId = System.Convert.ToInt32(UserId);
            OurCustomer        = OurCustomerData.Select_Record(OurCustomer);

            bool bSucess = false;

            bSucess = OurCustomerData.Delete(OurCustomer);
            if (bSucess == true)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("", "Can Not Delete");
            }
            return(null);
        }
コード例 #6
0
        // GET: /OurCustomer/Delete/<id>
        public ActionResult Delete(
            Int32?UserId
            )
        {
            if (
                UserId == null
                )
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }


            OurCustomer OurCustomer = new OurCustomer();

            OurCustomer.UserId = System.Convert.ToInt32(UserId);
            OurCustomer        = OurCustomerData.Select_Record(OurCustomer);

            if (OurCustomer == null)
            {
                return(HttpNotFound());
            }
            return(View(OurCustomer));
        }
コード例 #7
0
        public ActionResult Create([Bind(Include =
                                             "QbCustomerId"
                                             + "," + "QuickbooksAccessToken"
                                             + "," + "QuickbooksSecretToken"
                                             + "," + "QbSalesAccount"
                                             + "," + "QbSalesTax"
                                             + "," + "QbSalesDiscounts"
                                             + "," + "QbFreightIncome"
                                             + "," + "QbCash"
                                             + "," + "QbCostOfGoods"
                                             + "," + "QbUndepositiedFunds"
                                             + "," + "QbSalesId"
                                             + "," + "QbSalesTaxId"
                                             + "," + "QbDiscountsId"
                                             + "," + "QbFreightId"
                                             + "," + "QbCashId"
                                             + "," + "QbCostofGoodsId"
                                             + "," + "QbUndepositedFundsId"
                                         )] OurCustomer OurCustomer)
        {
            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = OurCustomerData.Add(OurCustomer);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Insert");
                }
            }

            return(View(OurCustomer));
        }
コード例 #8
0
            public TheirInvoice AddTheirInvoice(System.Guid InvoiceID, System.DateTime InvoiceDate, string Terms, string FOB, string PO, OurCustomer parentOurCustomerByCustomerInvoice)
            {
                TheirInvoice rowTheirInvoice = ((TheirInvoice)(this.NewRow()));

                rowTheirInvoice.ItemArray = new object[] {
                    InvoiceID,
                    null,
                    InvoiceDate,
                    Terms,
                    FOB,
                    PO,
                    parentOurCustomerByCustomerInvoice[0]
                };
                this.Rows.Add(rowTheirInvoice);
                return(rowTheirInvoice);
            }
コード例 #9
0
 public OurCustomerChangeEvent(OurCustomer row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #10
0
 public void RemoveOurCustomer(OurCustomer row)
 {
     this.Rows.Remove(row);
 }
コード例 #11
0
 public void AddOurCustomer(OurCustomer row)
 {
     this.Rows.Add(row);
 }
コード例 #12
0
 public Customer ConvertToCustomer(OurCustomer customer)
 {
     return(new Customer($"{customer.FirstName} {customer.LastName}"));
 }