예제 #1
0
        public static void MakePayment(decimal amount, string customerName)
        {
            // Some validation or logic on the customer record
            var customer = CustomerSystem.GetCustomer(customerName);

            // Submit payment for processing
            PaymentSystem.MakePayment(amount, customer);
        }
예제 #2
0
        public static void PurchaseItem(string customerName, string itemName, int quantity)
        {
            var item = InventorySystem.GetItem(itemName);

            var customer = CustomerSystem.GetCustomer(customerName);

            customer.ShoppingCart.Add(item, quantity);

            CustomerSystem.UpdateCustomer(customer);
        }
예제 #3
0
        public JsonResult LoadCustomerTransportPrice(string planId, string carType)
        {
            string                 strErrText;
            CustomerSystem         customer = new CustomerSystem();
            CustomerTransportPrice data     = customer.LoadCustomerTransportPriceByPlanId(long.Parse(planId), carType, LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(data.TransportPrice, JsonRequestBehavior.AllowGet));
            }
        }
예제 #4
0
        public JsonResult LoadCustomers()
        {
            string          strErrText   = string.Empty;
            CustomerSystem  customer     = new CustomerSystem();
            List <Customer> listCustomer = customer.LoadCustomers(LoginAccountId, LoginStaffName, out strErrText);

            if (listCustomer == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from c in listCustomer
                      select new
            {
                c.Id,
                c.Name
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public JsonResult LoadCustomerByName(string strName)
        {
            string         strErrText;
            CustomerSystem customer = new CustomerSystem();
            Customer       data     = customer.LoadCustomerByName(strName, LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            else
            {
                decimal decLoadingForceFeePrice   = 0;
                decimal decUnloadingForceFeePrice = 0;
                CustomerForceFeePrice data1       = customer.LoadCustomerForceFeePrice(data.Id, DateTime.Now, LoginAccountId, LoginStaffName, out strErrText);
                if (data1 != null)
                {
                    decLoadingForceFeePrice   = data1.LoadingForceFeePrice;
                    decUnloadingForceFeePrice = data1.UnloadingForceFeePrice;
                }

                decimal decStorageFeePrice    = 0;
                CustomerStorageFeePrice data2 = customer.LoadCustomerStorageFeePrice(data.Id, DateTime.Now, LoginAccountId, LoginStaffName, out strErrText);
                if (data2 != null)
                {
                    decStorageFeePrice = data2.StorageFeePrice;
                }

                var ret = new
                {
                    Id   = data.Id,
                    Name = data.Name,
                    LoadingForceFeePrice   = decLoadingForceFeePrice,
                    UnloadingForceFeePrice = decUnloadingForceFeePrice,
                    StorageFeePrice        = decStorageFeePrice,
                    OwnOrganId             = data.OwnOrganId
                };

                return(Json(ret, JsonRequestBehavior.AllowGet));
            }
        }
예제 #6
0
        public JsonResult LoadGenerateStorageAndForceFeeCustomersByTimespan(string startTime, string endTime)
        {
            string          strErrText;
            CustomerSystem  customer     = new CustomerSystem();
            List <Customer> listCustomer = customer.LoadGenerateStorageAndForceFeeCustomersByTimespan(startTime, endTime, LoginAccountId, LoginStaffName, out strErrText);

            if (listCustomer == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from c in listCustomer
                      select new
            {
                Id       = c.Id.ToString(),
                Name     = c.Name,
                FullName = c.FullName
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
예제 #7
0
        public JsonResult LoadGenerateBusinessPayersByTimespan(string startTime, string endTime)
        {
            string          strErrText;
            CustomerSystem  customer  = new CustomerSystem();
            List <Customer> listPayer = customer.LoadGenerateBusinessPayersByTimespan(startTime, endTime, LoginAccountId, LoginStaffName, out strErrText);

            if (listPayer == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from p in listPayer
                      orderby p.Name
                      select new
            {
                Id       = p.Id.ToString(),
                Name     = p.Name,
                FullName = p.FullName
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
예제 #8
0
 public static void AddCustomer(string name)
 {
     CustomerSystem.UpdateCustomer(new Customer {
         Name = name
     });
 }
예제 #9
0
 public static string ViewCustomers()
 {
     return(CustomerSystem.ViewCustomers());
 }
 public bool Update(CustomerSystem customerSystem)
 {
     return(_db.Update <CustomerSystem>(customerSystem));
 }
        public bool DeleteById(int id)
        {
            CustomerSystem customerSystem = _db.Find <CustomerSystem>(A => A.Id == id);

            return(_db.Delete <CustomerSystem>(customerSystem));
        }
 public bool Delete(CustomerSystem customerSystem)
 {
     return(_db.Delete <CustomerSystem>(customerSystem));
 }
 public bool Create(CustomerSystem customerSystem)
 {
     return(_db.Create <CustomerSystem>(customerSystem));
 }