public void Close(string pageId) { TabItem currentItem = null; var items = tabControl.Items; foreach (TabItem item in items) { if (item.Name.Equals(pageId)) { currentItem = item; break; } } if (currentItem != null) { // Remove the TabItem tabControl.Items.Remove(currentItem); // Remove the associated view model var containerHelper = FacadeFactory.Create(); containerHelper.Remove(pageId); } }
public bool approveRequest(RequestModel request, string currentUser) { bool status = _setStatusOfRequest(request, currentUser, RequestStatus.APPROVED); FacadeFactory.getRequestMovementService(context).allocateRequest(request.RequestId, currentUser); return(status); }
protected void Page_Load(object sender, EventArgs e) { if (!User.Identity.IsAuthenticated) { Response.Redirect("~/login.aspx?return=Views/DepartmentHead/DEMO_ViewAllPending.aspx"); } UserModel user = new UserModel(User.Identity.Name); List <RequestModel> pendings; using (SSISEntities context = new SSISEntities()) { pendings = FacadeFactory.getRequestService(context).getAllPendingRequestsOfDepartment(user.Department.dept_code).ToList(); } if (pendings.Count > 0) { gvPendings.DataSource = pendings; gvPendings.DataBind(); lblInfo.Text = pendings.Count + " requests."; } else { lblInfo.Text = "No pending requests."; } Session[SESSION_PENDINGS] = pendings; }
public ActionResult Success(string id) { var facade = FacadeFactory.GetInstance().GetFacade <MSPFacade>(); var order = facade.GetById <MSPOrder>(id); return(View(order)); }
private void OnStoreResult() { var facade = FacadeFactory.Create(); var overview = facade.Get <ResultOverview>(Bootstrap.Results) as ResultOverview; if (overview != null) { // Build the result and store it var paoResult = new PAOResult(); foreach (var item in RecentCards) { var resultItem = new PAOResultItem(); FillResultItem(item, resultItem); paoResult.Items.Add(resultItem); } // Add it to the overview. paoResult.Comment = "Added at " + DateTime.Now.ToShortDateString(); paoResult.DeckTitle = CurrentDeck.Title; overview.Add(paoResult); //TODO: Fire event that a reload is required in the result overview? var eventManager = facade.Get <EventController>(Bootstrap.EventManager); var newCardGameResult = eventManager.GetEvent(Bootstrap.EventNewCardGame); newCardGameResult.Trigger(); } }
protected void btnSubmitAll_Click(object sender, EventArgs e) { // Get all the models List<GenerateDisbursementViewModel> list = Session[SESSION_COLLECTION_PT_LIST] as List<GenerateDisbursementViewModel>; // Convert to ids and items to retrieve var listByRequestIds = list .SelectMany(sm => sm.RequestIds .Select(s => new { RequestId = s, sm.ItemCode, sm.Include, sm.CollectionPtId })) .Where(w => w.Include) .GroupBy(k => k.RequestId, v => v.ItemCode); using (SSISEntities context = new SSISEntities()) { foreach (var request in listByRequestIds) { FacadeFactory.getRequestMovementService(context).moveFromRetrievedToDisbursing(request.Key, request.ToList(), User.Identity.Name); } context.SaveChanges(); } _sendEmail(User.Identity.Name, list.Select(s => s.DeptCode).Distinct().ToList()); Response.Redirect(Request.Url.ToString(), false); }
public ActionResult Consulta(int id) { using (var facade = FacadeFactory.Item()) { var response = facade.Retrieve(id); return(PartialView("_Consulta", response)); } }
public Bootstrap() { // Init the IoC Facade! loader = new ComponentLoader(); FacadeFactory.InitFactory(); // Create a view model for the main windows Main = new MainWindowViewModel(); }
public Sender(FacadeFactory factory, PecParams pars, string loggerName, Action <string> sendMessage, Func <Exception, string> fullStacktrace, Func <bool> cancelRequest) { _factory = factory; _loggerName = loggerName; _parameters = pars; _sendMessage = sendMessage; _fullStacktrace = fullStacktrace; _cancelRequest = cancelRequest; }
/// <summary> /// Log all incoming text in a text file /// </summary> public string Index() { var path = Server.MapPath(string.Format("~/notification{0}.log", DateTime.Now.ToString("yyyy-MM-dd"))); //check post values string notification = new StreamReader(Request.InputStream).ReadToEnd(); //check get values string query = Request.Url.Query; string line = string.Format("[{0}] POST: {1} GET: {2}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), notification, query); if (System.IO.File.Exists(path)) { string oldText = System.IO.File.ReadAllText(path); using (var sw = new StreamWriter(path, false)) { sw.WriteLine(line); sw.Write(oldText); } } else { System.IO.File.WriteAllText(path, line); } //now stars the order processing //step 1: get the order from the MultiSafepay client var transactionid = Request["transactionid"]; var pm = new PaymentModel(); var c = new MultiSafepay.MultiSafepayClient(pm.ApiKey, apiUrl: pm.ApiUrls[0]); bool ordercompleted = false; var order = c.GetOrder(transactionid); if (order != null) { ordercompleted = order.Status == "completed"; } if (ordercompleted) { //get our order var facade = FacadeFactory.GetInstance().GetFacade <MSPFacade>(); var orderdb = facade.GetById <MSPOrder>(transactionid); if (orderdb != null) { orderdb.Status = MSPOrderStatus.Completed; facade.Save(); } } return("OK"); }
static void Main(string[] args) { Facade facade = FacadeFactory.GetFacade(); facade.PathToFile = @"..\..\..\Files\graph.csv"; GraphMenu graphMenu = new GraphMenu(facade); graphMenu.Menu(); }
public ResultPage(string id) { InitializeComponent(); pageId = id; var containerFacade = FacadeFactory.Create(); var vm = containerFacade.Get <ResultOverviewViewModel>(id); DataContext = vm; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Hide buttons first panelApproval.Visible = false; string requestedStr = Request.QueryString["id"]; int requestId; if (requestedStr == null) { return; } int.TryParse(requestedStr, out requestId); if (requestId == 0) { return; } RequestModel request; using (SSISEntities context = new SSISEntities()) { request = FacadeFactory.getRequestService(context).findRequestById(requestId); if (request == null) { lblInfo.Text = "Could not find that request"; return; } } Session[SESSION_REQUEST_ID] = requestId; lblRequestId.Text += requestedStr; lblEmployeeName.Text += request.Username; lblReason.Text += request.Reason; lblInfo.Text = "Status: " + request.Status; Dictionary <string, int> items = request.Items .Where(w => w.Value > 0) .ToDictionary(k => k.Key.Description, v => v.Value); if (request.Status == RequestStatus.PENDING || request.Status == RequestStatus.UPDATED) { panelApproval.Visible = true; } gvItems.DataSource = items; gvItems.DataBind(); } }
private void InternalSaveFile(string filename) { var facade = FacadeFactory.Create(); var ioService = facade.Get <IIOService>(Bootstrap.IoService); if (ioService != null) { var results = resultDict.Values; ioService.SaveResult(results, filename); } }
public Help(string id) { InitializeComponent(); var containerHelper = FacadeFactory.Create(); var vm = containerHelper.Get <HelpViewModel>(id); DataContext = vm; this.id = id; }
public CardGame(string id) { InitializeComponent(); this.id = id; var containerFacade = FacadeFactory.Create(); var vm = containerFacade.Get <CardGameViewModel>(id); DataContext = vm; }
protected void btnReject_Click(object sender, EventArgs e) { using (SSISEntities context = new SSISEntities()) { RequestModel request = FacadeFactory.getRequestService(context).findRequestById((int)Session[SESSION_REQUEST_ID]); FacadeFactory.getRequestService(context).rejectRequest(request, "Low Kway Boo"); context.SaveChanges(); } Response.Redirect("DEMO_ApproveRequest.aspx?id=" + (int)Session[SESSION_REQUEST_ID]); }
/// <summary> /// Closes the view model and the view. /// </summary> protected void InternalClose() { var id = page.GetId(); var helper = FacadeFactory.Create(); var uiService = helper.Get <IUiService>(); if (uiService != null) { uiService.Close(id); } }
private IEnumerable <PAOResult> InternalLoadFile(string filename) { var facade = FacadeFactory.Create(); var ioService = facade.Get <IIOService>(Bootstrap.IoService); if (ioService != null) { var result = ioService.LoadResult(filename); return(result); } return(null); }
protected void btnCancelRequest_Click(object sender, EventArgs e) { int requestId = (int)Session[SESSION_REQ_EDIT_ID]; string username = User.Identity.Name; using (SSISEntities context = new SSISEntities()) { FacadeFactory.getRequestService(context).setRequestToCancelled(requestId, username); context.SaveChanges(); } Response.Redirect("EmpRequestHistory.aspx", false); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } panelNoItems.Visible = false; panelNormal.Visible = false; using (SSISEntities context = new SSISEntities()) { var allocated = FacadeFactory.getRetrievalService(context).getAllRetrievingByClerk(User.Identity.Name); if (allocated.Count == 0) { panelNoItems.Visible = true; return; } panelNormal.Visible = true; var itemGroups = allocated.SelectMany(sm => sm.Items .Select(s => new { s.Key.ItemCode, s.Key.Description, Quantity = s.Value, sm.Department.dept_code, sm.RequestId, sm.Department.name }) ).GroupBy(k => k.ItemCode, v => v).ToList(); List <ConfirmRetrievalViewModel> list = new List <ConfirmRetrievalViewModel>(); foreach (var itemGroup in itemGroups) { int itemQty = itemGroup.Select(s => s.Quantity).Aggregate((a, b) => a + b); List <int> reqIds = itemGroup.Select(s => s.RequestId).ToList(); ConfirmRetrievalViewModel model = new ConfirmRetrievalViewModel(); model.ItemCode = itemGroup.Key; model.ItemDescription = itemGroup.First().Description; //model.DeptCode = deptGroup.Key; //model.DeptName = deptGroup.First().name; model.QuantityExpected = itemQty; model.QuantityActual = itemQty; model.RequestIds = reqIds; //model.Include = true; list.Add(model); } Session[SESSION_RETRIEVING_LIST] = list; _refreshGrid(list); } }
private string GetOriginalRecipients(string filePath) { var facadeFactory = new FacadeFactory(); var id = GetBoxId(Path.GetFileName(filePath)); try { return(facadeFactory.PECMailboxFacade.GetById(id).MailBoxName); } catch { return(string.Empty); } }
private void OnSaveFile() { var facade = FacadeFactory.Create(); var uiService = facade.Get <IUiService>(); try { InternalSaveFile(Source); } catch (IOServiceException serviceException) { uiService.ShowDialog(serviceException.Message, "Error"); } }
/// <summary> /// Construtor /// </summary> /// <param name="configuration">Configurações gerais da aplicação, passado por injeção de dependencia registrada no startup.cs</param> /// <param name="byCepSettings">Configurações da api utilizada para buscar cidades por CEP (Opção registrada no startup.cs)</param> /// <param name="autocompleteSettings">Configurações da api utilizada para buscar cidades para autocomplete (Opção registrada no startup.cs)</param> /// <param name="generalSettings">Configurações de funcionamento da aplicação (Opção registrada no startup.cs)</param> public CitiesController(IConfiguration configuration, IOptionsSnapshot <CityByCepApiSettings> byCepSettings, IOptionsSnapshot <CityAutocompleteApiSettings> autocompleteSettings, IOptionsSnapshot <GeneralSettings> generalSettings) { _configuration = configuration; _generalSettings = generalSettings.Value; _cityRepository = new CityRepository(_configuration); _temperatureRepository = new TemperatureRepository(_configuration); _bycepFacade = FacadeFactory <City> .Create(byCepSettings.Value); _autocompleteFacade = FacadeFactory <City> .Create(autocompleteSettings.Value); }
public ActionResult About() { using (var facade = FacadeFactory.Item()) { var response = facade.RetrieveCollection(new ItemCondition { Completed = false, UserId = 1 }); return(View(response)); } ViewBag.Message = "Your application description page."; return(View()); }
private void OnApplyChanges() { var facade = FacadeFactory.Create(); resultOverview = facade.Get <ResultOverview>(Bootstrap.Results); if (resultOverview != null) { // Get the ID of the current id and get the instance var id = CurrentResultOverview.Id; var item = resultOverview.PAOResults.Skip(id).First(); item.Comment = CurrentComment; item.DeckTitle = CurrentDeck; OnRefresh(); } }
//private void OnSelectedSource() //{ // var facade = new ContainerFacade(); // var uiService = facade.Get<IUiService>(); // var result = uiService.ShowOpenFileDialog(); // if (result != null) // { // Source = result; // RaisePropertyChange("Source"); // } //} private void OnLoadFile() { var facade = FacadeFactory.Create(); var uiService = facade.Get <IUiService>(); try { // Load the resutls and refresh the view var result = InternalLoadFile(Source); resultOverview = facade.Get <ResultOverview>(Bootstrap.Results); resultOverview.Reload(result); OnRefresh(); } catch (IOServiceException serviceException) { uiService.ShowDialog(serviceException.Message, "Error"); } }
public static List <WCFRetieve> GetAllPossibleRetrievalsForUser(string currentUser) { List <WCFRetieve> wcfList = new List <WCFRetieve>(); using (SSISEntities context = new SSISEntities()) { //Move all from allocated to retrieving automatically var allocated = FacadeFactory.getAllocatedService(context).getAllAllocated(); if (allocated.Count > 0) { foreach (var allocModel in allocated) { List <string> items = allocModel.Items.Select(s => s.Key.ItemCode).ToList(); FacadeFactory.getRequestMovementService(context).moveFromAllocatedToRetrieving(allocModel.RequestId, items, currentUser); } } context.SaveChanges(); var retrieving = FacadeFactory.getRetrievalService(context).getAllRetrievingByClerk(currentUser); var itemGroups = retrieving.SelectMany(sm => sm.Items .Select(s => new { s.Key.ItemCode, s.Key.Description, Quantity = s.Value, sm.Department.dept_code, sm.RequestId, sm.Department.name }) ).GroupBy(k => k.ItemCode, v => v).ToList(); foreach (var itemGroup in itemGroups) { int itemQty = itemGroup.Select(s => s.Quantity).Aggregate((a, b) => a + b); //List<int> reqIds = itemGroup.Select(s => s.RequestId).ToList(); WCFRetieve wcfItem = new WCFRetieve(); wcfItem.ItemDes = itemGroup.First().Description; wcfItem.TotalQty = itemQty.ToString(); wcfItem.ItemCode = itemGroup.Key; wcfList.Add(wcfItem); } } return(wcfList); }
public ResultOverviewViewModel() { Close = new DefaultCommand(OnClose); Refresh = new DefaultCommand(OnRefresh); SaveFile = new DefaultCommand(OnSaveFile); LoadFile = new DefaultCommand(OnLoadFile); ApplyChanges = new DefaultCommand(OnApplyChanges, IsContentChanged); //SelectSource = new DefaultCommand(OnSelectedSource); var facade = FacadeFactory.Create(); var eventManager = facade.Get <EventController>(Bootstrap.EventManager); var newDataEvent = eventManager.GetEvent(Bootstrap.EventNewCardGame); newDataEvent.AddListener(this); OnRefresh(); }
private void OnRefresh() { var facade = FacadeFactory.Create(); resultOverview = facade.Get <ResultOverview>(Bootstrap.Results); if (resultOverview != null) { Source = resultOverview.Source; // Create a list and and an ID integer to play with later. var list = new List <PAOResultOverview>(); int id = 0; // Use a temporary list instead of the enumeration of the instance, because we need to add tests items maybe. resultDict = new Dictionary <int, PAOResult>(); var results = new List <PAOResult>(); results.AddRange(resultOverview.PAOResults); // // Create some fake results for debugging if enabled // AddDebugValues(results); foreach (var paoResult in results) { var paoResultOverview = new PAOResultOverview(id); paoResultOverview.Comment = paoResult.Comment; paoResultOverview.Deck = paoResult.DeckTitle; list.Add(paoResultOverview); resultDict.Add(id, paoResult); id++; } // Refresh the UI Results = new ObservableCollection <PAOResultOverview>(list); RaisePropertyChange("Results"); oldComment = null; oldCurrentDeck = null; ApplyChanges.Refresh(); } }