public ActionResult Index() { Dictionary <string, object> query = new Dictionary <string, object>(); query.Add("Organization.Id", int.Parse(getCurrentEnterpriseId())); query.Add("[in]Id", ((Store.Core.Account.User)Session[DataGlobals.ACCOUNT_KEY]).ObjectsCSV); IList <StorageName> storageNames = storageNameRepository.GetByCriteria(query); SelectList storageNameList = new SelectList(storageNames, "Id", "Name", Session["storageNameId"] != null ? (string)Session["storageNameId"] : "-1"); ViewData[DataGlobals.REFERENCE_STORAGE_SHOP_NAME] = storageNameList; if (storageNames.Count > 0) { Session["idStorage"] = storageNames[0].Id.ToString(); } int messRowCount = 0; int.TryParse((string)Session["row_count"], out messRowCount); Session.Remove("row_count"); if (messRowCount > 0) { for (int i = 0; i < messRowCount; i++) { ViewData["messRow" + i] = Session["messRow" + i]; Session.Remove("messRow" + i); } } ViewData["row_count"] = messRowCount.ToString(); return(View(viewName)); }
public ActionResult Index() { Dictionary <string, object> query = new Dictionary <string, object>(); query.Add("Organization.Id", int.Parse(getCurrentEnterpriseId())); query.Add("[in]Id", ((Store.Core.Account.User)Session[DataGlobals.ACCOUNT_KEY]).ObjectsCSV); IList <StorageName> storageNames = storageNameRepository.GetByCriteria(query); SelectList storageNameList = new SelectList(storageNames, "Id", "Name", Session["storageNameId"] != null ? (string)Session["storageNameId"] : "-1"); ViewData[DataGlobals.REFERENCE_STORAGE_SHOP_NAME] = storageNameList; return(View(viewName)); }
public ActionResult Index(string date, string dateEnd, string idStorage, int?OperTypes, int?Shops, int?Nomenclature) { IList <OperType> operationTypes = operationTypeRepository.GetAll(); OperType oType = new OperType(0, "Любой"); operationTypes.Insert(0, oType); SelectList operationTypesList = new SelectList(operationTypes, "Id", "Name"); ViewData[Store.Data.DataGlobals.REFERENCE_OPER_TYPE] = operationTypesList; Dictionary <string, object> query = new Dictionary <string, object>(); query.Add("Organization.Id", int.Parse(getCurrentEnterpriseId())); query.Add("[in]Id", ((Store.Core.Account.User)Session[DataGlobals.ACCOUNT_KEY]).ObjectsCSV); IList <StorageName> storageNames = storageNameRepository.GetByCriteria(query); SelectList storageNameList = new SelectList(storageNames, "Id", "Name", Session["storageNameId"] != null ? (string)Session["storageNameId"] : "-1"); ViewData[DataGlobals.REFERENCE_STORAGE_SHOP_NAME] = storageNameList; Dictionary <string, object> queryParams = new Dictionary <string, object>(); Dictionary <string, object> orderParams = new Dictionary <string, object>(); if (!(idStorage != null && idStorage != "-1")) { foreach (var item in storageNames) { idStorage = item.Id.ToString(); break; } } int id = System.Int32.Parse(idStorage); if (date == null) { date = DateTime.Today.ToString("dd.MM.yy"); } DateTime dt = DateTime.ParseExact(date + " 00:00:00", DataGlobals.DATE_TIME_FORMAT, null); if (dateEnd == null) { dateEnd = DateTime.Today.ToString("dd.MM.yy"); } DateTime dtEnd = DateTime.ParseExact(dateEnd + " 23:59:59", DataGlobals.DATE_TIME_FORMAT, null); Session.Add("dateString", date); Session.Add("dateEndString", dateEnd); Session.Add("idStorage", idStorage); queryParams.Add("OrganizationId", int.Parse(getCurrentEnterpriseId())); queryParams.Add("StorageNameId", id); queryParams.Add("[>=]OperDate", dt); queryParams.Add("[<=]OperDate", dtEnd); if (OperTypes != null) { if (OperTypes > 0) { queryParams.Add("OperTypeId", OperTypes); } } if (Shops != null) { queryParams.Add("ShopId", (int)Shops); } if (Nomenclature != null) { queryParams.Add("NomenclatureId", (int)Nomenclature); } orderParams.Add("OperDate", ASC); IList <OperationSimple> operations = operationSimpleRepository.GetByLikeCriteria(queryParams, orderParams); return(View(viewName, operations)); }