public void test()
        {
            var now    = DateTime.Now;
            var result = BizLogic.CheckAllowOrderAtSameLocation(now);

            Assert.AreEqual(false, result);
        }
Example #2
0
        public void IssueVoucher(string id, string uid)
        {
            var ar = _context.AdjustmentRecord.FirstOrDefault(x => x.VoucherNo == id);

            if (ar != null)
            {
                var arList = _context.RecordDetails.Where(x => x.Rrid == id);
                if (arList != null)
                {
                    //value of voucher
                    decimal?amount      = new BizLogic().GetTotalAmountForVoucher(id);
                    decimal?GST         = Math.Round((decimal)(amount * (decimal?)0.07), 2);
                    decimal?totalAmount = amount + GST;
                    ar.Status       = "Approved";
                    ar.SuperviserId = int.Parse(uid);
                    ar.ApproveDate  = DateTime.Now.Date;
                    _context.AdjustmentRecord.Update(ar);
                    _context.SaveChanges();

                    foreach (var item in arList.ToList())
                    {
                        new BizLogic().UpdateCatalogueStockAfterSuppDeliveryOrVoucherApproved(item.ItemNumber, item.Quantity);
                        int balance = _context.Catalogue.Find(item.ItemNumber).Stock;
                        new BizLogic().UpdateInventoryTransRecord(item.ItemNumber, id, item.Quantity, balance);
                    }
                }
            }
        }
        public static void CheckArgs(String[] args)
        {
            var user = new Domain.User("test", "test");

            if (args != null)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i] == "-l" && i + 1 <= args.Length)
                    {
                        ShowSales(args[i + 1]);
                    }
                    else if (args[i] == "-s")
                    {
                        BizLogic.SetCommand();
                    }
                    else if (args[i] == "-H")
                    {
                        Program.LogIn(out user);
                        Helpers.OrderHistory(user);
                        System.Environment.Exit(1);
                    }
                }
            }
        }
Example #4
0
        public ActionResult OrdersByCust(string custName)
        {
            List <Order> orders = BizLogic.GetOrderbyUserName(custName);

            ViewBag.orders = orders;
            return(View());
        }
Example #5
0
        public List <string> GetVoucher(string id)
        {
            List <string> result = new List <string>();
            List <StationeryRetrievalList> source = new BizLogic().GetStationeryRetrievalLists();
            StationeryRetrievalList        ad     = source.Where(s => s.ItemNumber == id).ToList().First();

            if (ad == null)
            {
                return(null);
            }
            else
            {
                BizLogic  k    = new BizLogic();
                Catalogue cata = _context.Catalogue.Where(s => s.ItemName == ad.ItemName).ToList().First();
                result.Add(cata.Category);
                result.Add(ad.ItemName);
                result.Add(ad.Quantity.ToString());
                result.Add(ad.QuantityRetrieved.ToString());
                //this part in fact is price
                if (ad.Quantity == ad.QuantityRetrieved)
                {
                    result.Add("finished");
                }
                else
                {
                    result.Add("Unfinished");
                }
                return(result);
            }
        }
Example #6
0
        public List <string> GetList1(string id)
        {
            List <string> result = new List <string>();
            List <StationeryRetrievalList> source = new BizLogic().GetStationeryRetrievalLists();
            List <Catalogue> l = _context.Catalogue.Where(s => s.Category == id).ToList();
            List <string>    k = new List <string>();

            foreach (Catalogue h in l)
            {
                k.Add(h.ItemNumber);
            }
            List <StationeryRetrievalList> finalsource = source.Where(s => k.Contains(s.ItemNumber)).ToList();

            //List<retrievetemp> result = new List<retrievetemp>();
            foreach (StationeryRetrievalList temp in finalsource)
            {
                //Catalogue cata = _context.Catalogue.Where(s => s.ItemName == temp.ItemName).ToList().First();
                //retrievetemp tmp = new retrievetemp();
                //tmp.Catagory = cata.Category;
                //tmp.ItemName = cata.ItemName;
                //tmp.Count = temp.Quantity;
                //if (temp.QuantityRetrieved == 0)
                //    tmp.stats = false;
                //else
                //    tmp.stats = true;
                result.Add(temp.ItemNumber);
            }
            return(result);
        }
Example #7
0
        public ActionResult DeleteOrder(int orderid)
        {
            Order o = BizLogic.GetOrderbyOrderID(orderid);

            BizLogic.DeleteOrder(orderid);
            return(Redirect("~/orders/" + o.UserName));
        }
Example #8
0
        public List <string> GetRetrieveDetail(string id, string mode)
        {
            List <string> result = new List <string>();
            List <StationeryRetrievalList> source = new BizLogic().GetStationeryRetrievalLists();
            StationeryRetrievalList        temp   = source.Where(s => s.ItemNumber == id).ToList().First();
            Catalogue cata = _context.Catalogue.Where(s => s.ItemNumber == id).ToList().First();

            result.Add(cata.Category);
            result.Add(cata.ItemName);
            if (mode.Equals("summary"))
            {
                result.Add(cata.Out.ToString());
            }
            else
            {
                result.Add(temp.Quantity.ToString());
            }
            if (temp.QuantityRetrieved == temp.Quantity)
            {
                result.Add("finished");
            }
            else
            {
                result.Add("waiting");
            }
            return(result);
        }
        public void Fail2CheckAllowOrderOnlySameLocation()
        {
            var now    = DateTime.Now;
            var time   = now.AddHours(-20);
            var result = BizLogic.CheckAllowOrderOnlySameLocation(time, "here", "here");

            Assert.AreEqual(false, result);
        }
        public void testCheckAllowOrderAtSameLocation()
        {
            var now    = DateTime.Now;
            var time   = now.AddHours(-3);
            var result = BizLogic.CheckAllowOrderAtSameLocation(time);

            Assert.AreEqual(true, result);
        }
Example #11
0
        public void AddContact_PhoneNumberIsWhiteSpace_GetNullExceptionBack()
        {   //Access
            var bizlogic = new BizLogic();

            //Act
            string  PhoneNumber = " ";
            Contact contact     = new Contact(PhoneNumber);

            bizlogic.AddContact(contact);
        }
Example #12
0
        public ActionResult New()
        {
            var foodLists      = BizLogic.GetFoodList();
            var orderViewModel = new ViewModels.OrderFormViewModel
            {
                Order     = new Order_View(),
                FoodLists = foodLists
            };

            return(View("New", orderViewModel));
        }
Example #13
0
        public void GetContact_IsPhoneNumberEqual_GetExceptionBack()
        {
            //Arrange
            var target = new BizLogic();

            //Act
            Contact actual = target.GetContact("923456789");

            //Assert
            Assert.AreEqual("923456789", actual);
        }
Example #14
0
        public void GetContact_PhoneNumberIsBlank_GetNullExceptionBack()
        {   //Arrange
            var bizlogic = new BizLogic();

            //Act
            string PhoneNumber = "";

            bizlogic.GetContact(PhoneNumber);

            //Assert
        }
Example #15
0
        public void GetContact_ContactInstance_NotActual()
        {
            //Arrange
            var target = new BizLogic();

            //Act
            Contact actual = target.GetContact("923456789");

            //Assert
            Assert.IsNotNull(actual);
            Assert.IsInstanceOfType(actual, typeof(Contact));
        }
Example #16
0
        public async Task <string> PFitemAsync(string amount, string rdid)
        {
            List <StationeryRetrievalList> source = new BizLogic().GetStationeryRetrievalLists();
            StationeryRetrievalList        temp   = source.Where(s => s.ItemName.Contains(rdid)).ToList().First();

            //this part input change out
            //temp.QuantityDelivered = int.Parse(amount);
            //_context.Update(temp);
            //await _context.SaveChangesAsync();
            new BizLogic().UpdateCatalogueOutAndStockAfterRetrieval(temp.ItemNumber, int.Parse(amount));
            return("123");
        }
        public HttpResponseMessage Post([FromBody] ValuesViewModel postValue)
        {
            DebugMessage("handling post request in controller");
            var domainObject = BizLogic.PostOne("Values", new SampleDto()
            {
                DomainString = postValue.ResourceModelString
            });

            postValue.SetId(domainObject.SampleDomainId, "Values");

            return(base.MakeResponse(postValue));
        }
Example #18
0
        public void DeleteContact_PhoneNumberIsWhiteSpace_GetNullExceptionBack()
        {
            //Arrange
            var bizlogic = new BizLogic();

            //Act
            string PhoneNumber = " ";

            bizlogic.DeleteContact(PhoneNumber);

            //Assert
        }
Example #19
0
        public void UpdateContact_PhoneNumberIsBklank_GetNullExceptionBack()
        {
            //Access
            var bizlogic = new BizLogic();

            //Act
            string  PhoneNumber = "";
            Contact contact     = new Contact(PhoneNumber);

            bizlogic.UpdateContact(contact);

            //Assert
        }
        public IEnumerable <ValuesViewModel> GetAll([FromUri] string filter = "")
        {
            var resourceModelList = new List <ValuesViewModel>();
            var dm = BizLogic.GetMany("Values", filter);

            foreach (var model in dm)
            {
                resourceModelList.Add(new ValuesViewModel(model.SampleDomainId, "Values")
                {
                    ResourceModelString = model.SampleDomainString
                });
            }
            return(resourceModelList);
        }
        public IHttpActionResult GetSingle(int id)
        {
            var domainModel = BizLogic.GetOne("Values", id.ToString());

            if (domainModel == null)
            {
                return(NotFound());
            }
            // todo: implement automapper for this
            return(Ok(new ValuesViewModel(domainModel.SampleDomainId, "Values")
            {
                ResourceModelString = domainModel.SampleDomainString
            }));
        }
Example #22
0
        //public IActionResult Index()
        //{
        //    DateTime start = DateTime.Now;
        //    DateTime cutoff = DateTime.Now;
        //    if (start.DayOfWeek >= DayOfWeek.Thursday)
        //    {
        //        start = start.AddDays(-7);
        //    }
        //    while (start.DayOfWeek != DayOfWeek.Thursday)
        //    {
        //        start = start.AddDays(-1);
        //    }
        //    Console.WriteLine("{0}", start);

        //    if (cutoff.DayOfWeek >= DayOfWeek.Wednesday)
        //    {
        //        while (cutoff.DayOfWeek != DayOfWeek.Wednesday)
        //        {
        //            cutoff = cutoff.AddDays(-1);
        //        }
        //    }
        //    else
        //    {
        //        while (cutoff.DayOfWeek != DayOfWeek.Wednesday)
        //        {
        //            cutoff = cutoff.AddDays(1);
        //        }
        //    }
        //    Console.WriteLine("{0}", cutoff);
        //    return View();
        //}

        public IActionResult Index()
        {
            BizLogic b    = new BizLogic();
            string   test = new BizLogic().IDGenerator("DL");

            Console.WriteLine("{0}", test);

            List <RecordDetails> rd = b.GenerateDisbursementListDetails("ENGL");

            foreach (RecordDetails i in rd)
            {
                Console.WriteLine("{0}, {1}, {2}", i.Rrid, i.ItemNumber, i.Quantity);
            }
            return(View());
        }
Example #23
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            bizLogic = new BizLogic(this);
            if (savedInstanceState == null)
            {
                var currentView = bizLogic.GetCurrentView();
                System.Diagnostics.Debug.WriteLine(currentView);
                NavigateTo(currentView);
            }
        }
Example #24
0
        public List <string> GetVoucher(string id)
        {
            List <string>    result = new List <string>();
            AdjustmentRecord ad     = _context.AdjustmentRecord.Where(s => s.VoucherNo == id).ToList().First();

            if (ad == null)
            {
                return(null);
            }
            else
            {
                BizLogic k = new BizLogic();
                result.Add(ad.VoucherNo);
                result.Add(ad.IssueDate.Date.ToString());
                result.Add(k.getPriceForAdjust(ad.VoucherNo));
                //this part in fact is price
                result.Add(ad.Status);
                return(result);
            }
        }
Example #25
0
        public void ApplyVoucher(int id)
        {
            List <RecordDetails> source = _context.RecordDetails.Where(s => s.Rrid == ("VTemp" + id)).ToList();
            string vono = new BizLogic().IDGenerator("V");
            //shengcheng vocher
            AdjustmentRecord temp = new AdjustmentRecord();

            temp.VoucherNo = vono;
            temp.ClerkId   = id;
            temp.IssueDate = DateTime.Now;
            temp.Status    = "Pending Approval";
            _context.AdjustmentRecord.Add(temp);
            foreach (RecordDetails i in source)
            {
                i.Rrid = vono;
                _context.RecordDetails.Update(i);
            }
            _context.SaveChanges();
            //save changes
        }
Example #26
0
        public ActionResult EditOrder(int orderid)
        {
            Order      o  = BizLogic.GetOrderbyOrderID(orderid);
            Order_View ov = new Order_View();

            ov.OrderId  = o.OrderId;
            ov.UserName = o.UserName;
            ov.FoodID   = o.FoodID;
            ov.Size     = o.Size;
            ov.Chilli   = o.Chilli == "Y";
            ov.MoreSalt = o.MoreSalt == "Y";
            ov.Pepper   = o.Pepper == "Y";
            var foodLists      = BizLogic.GetFoodList();
            var orderViewModel = new ViewModels.OrderFormViewModel
            {
                Order     = ov,
                FoodLists = foodLists
            };

            return(View("New", orderViewModel));
        }
Example #27
0
        public MainPage()
        {
            this.InitializeComponent();

            ApplicationView.PreferredLaunchViewSize = new Size {
                Width = 480, Height = 640
            };
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            bizLogic = new BizLogic(this);

            var app = Application.Current as App;

            app.BizLogic = bizLogic;

            ContentFrame = new Frame();
            GridContent.Children.Add(ContentFrame);
            var viewName = bizLogic.GetCurrentView();

            ContentFrame.Navigate(stringToPage[viewName]);
        }
Example #28
0
        public List <string> GetRetrieve()
        {
            List <string> result = new List <string>();
            List <StationeryRetrievalList> source = new BizLogic().GetStationeryRetrievalLists();

            //List<retrievetemp> result = new List<retrievetemp>();
            foreach (StationeryRetrievalList temp in source)
            {
                Catalogue cata = _context.Catalogue.Where(s => s.ItemName == temp.ItemName).ToList().First();
                //retrievetemp tmp = new retrievetemp();
                //tmp.Catagory = cata.Category;
                //tmp.ItemName = cata.ItemName;
                //tmp.Count = temp.Quantity;
                //if (temp.QuantityRetrieved == 0)
                //    tmp.stats = false;
                //else
                //    tmp.stats = true;
                result.Add(cata.ItemNumber);
            }
            return(result);
        }
Example #29
0
        public List <string> GetVoucher1(string id)
        {
            List <string>    result = new List <string>();
            AdjustmentRecord ad     = _context.AdjustmentRecord.Where(s => s.VoucherNo == id).ToList().First();

            if (ad == null)
            {
                return(null);
            }
            else
            {
                BizLogic k = new BizLogic();
                result.Add(ad.VoucherNo);
                var l = _context.User.Where(s => s.UserId == ad.ClerkId).ToList().First();
                result.Add(l.Name);
                result.Add(k.getPriceForAdjust(ad.VoucherNo));
                //this part in fact is price
                result.Add(ad.Status);
                return(result);
            }
        }
Example #30
0
        public ActionResult Save(OrderFormViewModel orderformViewModel)
        {
            int    orderid  = orderformViewModel.Order.OrderId;
            string custName = orderformViewModel.Order.UserName;
            int    foodId   = orderformViewModel.Order.FoodID;
            int    size     = orderformViewModel.Order.Size;
            string chilli   = orderformViewModel.Order.Chilli ? "Y" : "N";
            string moresalt = orderformViewModel.Order.MoreSalt ? "Y" : "N";
            string pepper   = orderformViewModel.Order.Pepper ? "Y" : "N";

            if (orderid == 0)
            {
                BizLogic.MakeOrder(custName, foodId, size, chilli, moresalt, pepper);
            }
            else
            {
                BizLogic.UpdateOrder(orderid, custName, foodId, size, chilli, moresalt, pepper);
            }


            return(Redirect("~/orders/" + custName));
        }