Exemplo n.º 1
0
        /// <summary>
        /// Allows user to add to an existing inventory item
        /// </summary>
        public void AddQuantity()
        {
            int quantity;

            // Display inventory and inventory action
            ShowAllItems();
            _output.Send("ADD TO QUANTITY");

            // Get user input
            _output.Send("What is the item id?");
            var itemId = _input.ReadData();

            _output.Send("How many would you like to upload into the system?");
            var itemQuantity = _input.ReadData();

            try
            {
                quantity = Int32.Parse(itemQuantity);
            }
            catch (Exception)
            {
                _output.Send("The quantity entered is invalid.");
                Thread.Sleep(1000);
                Console.Clear();
                return;
            }
            _inventoryManager.Add(itemId, quantity);
            Thread.Sleep(1000);
            Console.Clear();
        }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "Id,Name,SizeId,PriceToBuy,PriceToBook,IsBought,IsCopy,Wedding,FrontPicLink,CloserPicLink,BackPicLink")] Dress dress)
        {
            if (!User.IsInRole(Constants.AdminRoleName))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }
            if (ModelState.IsValid)
            {
                try
                {
                    dataManager.Add(dress);
                    return(RedirectToAction("Index"));
                } catch (Exception e)
                {
                    return(RedirectToAction("Create", new { error = e.Message }));
                }
            }
            var items = Constants.sizes.Select((s, index)
                                               => new SelectListItem {
                Text = s, Value = index.ToString()
            });

            ViewBag.SizeId = new SelectList(items, "Value", "Text", dress.SizeId);
            return(View(dress));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> NewRecord([FromBody] RecordModel model)
        {
            if (await dataManager.Add(model))
            {
                return(Ok("new record successfully written"));
            }

            return(StatusCode(400));
        }
Exemplo n.º 4
0
        public virtual IHttpActionResult Post(TViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            TModel     model           = dataManager.Add(ToModel(viewModel));
            TViewModel createViewModel = ToViewModel(model);

            return(Ok(createViewModel));
        }
Exemplo n.º 5
0
        public void Log(LogLevel level, string message)
        {
            var log = new Log
            {
                Id      = Helpers.GetID(),
                Level   = level,
                Message = message
            };

            _repo.Add(log);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Process the input for the diff
        /// </summary>
        /// <param name="id">The id of the comparision</param>
        /// <param name="side">left or right</param>
        /// <param name="request">JSON base64 encoded binary data</param>
        /// <returns>HTTP Response</returns>
        private IHttpActionResult ProcessInput(string id, string side, DiffRequest request)
        {
            if (string.IsNullOrEmpty(request?.Data))
            {
                return(BadRequest());
            }

            Initialize();

            _dataManager.Add($"{id}-{side}", request.Data);
            return(Created($"v1/diff/{id}/{side}", request.Data));
        }
Exemplo n.º 7
0
        private void OnNewProfile(object sender, EventArgs e)
        {
            var profile = manager.New();

            using (IProfileView profileView = ClientServiceLocator.GetService <IViewFactory>().CreateProfileView()) {
                var controller = ClientServiceLocator.GetService <IProfileController>();
                controller.SetView(profileView);
                controller.SetManager(manager);
                controller.SetProfile(profile, true);
                if (controller.Show())
                {
                    manager.Add(profile);
                    view.ReloadList();
                    view.SetSelectByName(profile.Name);
                }
            }
        }
        public bool SaveContact(Contact contact)
        {
            bool bret = false;

            try
            {
                var ctx = HttpContext.Current;
                SetCache();
                m_cdatamgr.Add(ref ctx, ref m_cdbmgr, ref contact);
                bret = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(m_cdbmgr.GetException(ref ex));
                bret = false;
            }
            return(bret);
        }
Exemplo n.º 9
0
 public ActionResult Create([Bind(Include = "Id,DressId,UserId,StartDate,EndDate,Sum,Booking")] Order order)
 {
     if (ModelState.IsValid)
     {
         try
         {
             string login = User.Identity.Name;
             if (String.IsNullOrEmpty(login))
             {
                 login = null;
             }
             order.UserName = login;
             dataManager.Add(order);
         }
         catch (Exception e)
         {
             return(RedirectToAction("Create", new { error = e.Message, dressId = order.DressId }));
         }
         return(RedirectToAction("Details", new { id = order.Id }));
     }
     return(View(order));
 }
Exemplo n.º 10
0
        /// <summary>
        /// Gets all the Information from the Student and adds it to the Data Manager.
        /// </summary>
        /// <param name="dataManager">Where all information is stored (Database or in a List).</param>
        public void generateInformation(IDataManager dataManager)
        {
            Phases  previousPhases  = null;
            Summary previousSummary = null;

            //Extracts the zip files, reads them and saves the information in the linker
            foreach (var project in Read <StateAccess, List <Data> >("state"))
            {
                var programInfo = new ProgramInformation(student, project["name"].getProgram());
                //Makes sure that the Program  is contained in the Options
                if (!programInfo.program.isValidProgram())
                {
                    continue;
                }
                programs.Add(programInfo);

                //Reads the data from .def and .dat
                var dataDef = Read <DefectAccess, List <Data> >(project["defectLog"]);
                var dataDat = Read <DatAccess, Data>(project["dataFile"]);

                //Gets all the information from the data read and saves it in the linker
                var defectLogs = programInfo.getDefectLogs(dataDef);
                dataManager.Add(defectLogs);
                var sets = programInfo.getSETS(dataDat);
                dataManager.Add(sets);
                var probe = programInfo.getPROBE(dataDat);
                dataManager.Add(probe);
                var phases = programInfo.getPhases(dataDat, sets, ref previousPhases, probe);
                dataManager.Add(phases);
                var summary = programInfo.getSummary(dataDat, sets, ref previousPhases, ref previousSummary);
                dataManager.Add(summary);
            }
            //Reads the data from Time Log and saves it in the linker
            var dataTimeLog1 = Read <TimeLogAccess, List <Data> >("timelog.xml");
            var dataTimeLog2 = Read <TimeLogAccess, List <Data> >("timelog2.xml");
            var timeLogs     = getTimeLogs(dataTimeLog1).Concat(getTimeLogs(dataTimeLog2));

            dataManager.Add(timeLogs);
        }
Exemplo n.º 11
0
 public Task <RandomizerList> AddList(RandomizerList list)
 {
     return(_DataManager.Add(list));
 }
Exemplo n.º 12
0
 public T Add(T TEntity)
 {
     return(_repo.Add(TEntity));
 }