private MakeNewRequestModel _updateViewModelItem(MakeNewRequestModel model)
        {
            List <Stock_Inventory> stocks   = Session[SESSION_STOCKS] as List <Stock_Inventory>;
            RequestModelCollection requests = Session[SESSION_APPROVED_REQS] == null ? null : Session[SESSION_APPROVED_REQS] as RequestModelCollection;

            if (model.CurrentItem == null)
            {
                model.UnitOfMeasure = "";
                model.Approved      = new List <string>();

                return(model); // EARLY RETURN
            }

            model.UnitOfMeasure = stocks.Where(w => w.item_code == model.CurrentItem).First().unit_of_measure;

            if (requests == null)
            {
                model.Approved = new List <string>();
            }
            else
            {
                model.Approved = requests
                                 .SelectMany(s =>
                {
                    string date = s.Date.ToShortDateString();
                    IEnumerable <string> its = s.Items
                                               .Where(w => w.Key.ItemCode == model.CurrentItem)
                                               .Select(ss =>
                    {
                        string result = string
                                        .Format("({0}) {1} - {2} ({3})",
                                                ss.Key.Category.cat_name,
                                                ss.Key.Description,
                                                ss.Value,
                                                date
                                                );
                        //string res = "";
                        //res += ss.Key.Category.cat_name;
                        //res += " " + ss.Key.Description;
                        //res += " (" + date + ")";
                        return(result);
                    });

                    return(its);
                }
                                             ).ToList();
            }

            return(model);
        }
        private MakeNewRequestModel _makeNewModel(int count, int catId, string itemCode, int qty)
        {
            List <Category>        cats     = Session[SESSION_CATEGORIES] as List <Category>;
            List <Stock_Inventory> stocks   = Session[SESSION_STOCKS] as List <Stock_Inventory>;
            RequestModelCollection requests = Session[SESSION_APPROVED_REQS] == null ? null : Session[SESSION_APPROVED_REQS] as RequestModelCollection;

            MakeNewRequestModel model = new MakeNewRequestModel();

            model.Num      = count + 1;
            model.Quantity = qty;
            model.DictCats = cats.ToDictionary(k => k.cat_id.ToString(), v => v.cat_name);

            if (catId == 0)
            {
                model.CurrentCategory = cats.First().cat_id;
            }
            else
            {
                model.CurrentCategory = catId;
            }

            return(_updateViewModelCategory(model, itemCode));
        }