public ActionResult SubmitRequirementStatus(SubmitYourRequirement statusViewModel) { ResponseOut responseOut = new ResponseOut(); IAdminBL adminBL = new AdminEngine(); try { if (statusViewModel != null) { int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]); responseOut = adminBL.SubmitPostStatus(statusViewModel); } else { responseOut.message = ActionMessage.ProbleminData; responseOut.status = ActionStatus.Fail; } } catch (Exception ex) { Log.Error("Error in AdminController/SubmitRequirementStatus", ex); responseOut.message = ActionMessage.ApplicationException; responseOut.status = ActionStatus.Fail; } return(Json(responseOut, JsonRequestBehavior.AllowGet)); }
public ActionResult WhatClientSays(WhatClientSays feedback) { ResponseOut responseOut = new ResponseOut(); IAdminBL adminBL = new AdminEngine(); try { if (feedback != null) { int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]); responseOut = adminBL.SubmitClientFeedback(feedback); } else { responseOut.message = ActionMessage.ProbleminData; responseOut.status = ActionStatus.Fail; } } catch (Exception ex) { Log.Error("Error in AdminController/WhatClientSays", ex); responseOut.message = ActionMessage.ApplicationException; responseOut.status = ActionStatus.Fail; } return(Json(responseOut, JsonRequestBehavior.AllowGet)); }
public static void ProcessChatMessage(IConnection connection, string message, ChatType type) { if (AdminEngine.ProcessChatMessage(connection, message)) { return; } ChatService.ProcessMessage(connection, message, type); }
private void addConcertBtn_Click(object sender, EventArgs e) { List <AvailableArtistsView> availableArtists = AdminEngine.GetAvailableArtists(); List <AvailableScenesView> availableScenes = AdminEngine.GetAvailableScenes(); AddConcert addConcertForm = new AddConcert(availableArtists, availableScenes); addConcertForm.Show(); this.Hide(); }
private static void Started() { Server = new TcpServer("127.0.0.1", 8889, 100); LService = new LoginService( "127.0.0.1", 6668, "TRUEPASSWORD", new GsInfo(1, "NecrozEMU", "127.0.0.1", 8889)); LService.Start(); AdminEngine.Init(); PlayerService.Init(); TaskManager.Init(); Server.BeginListening(); }
public ActionResult WhatClientSays() { List <WhatClientSays> feedback = new List <WhatClientSays>(); IAdminBL adminBL = new AdminEngine(); try { feedback = adminBL.GetClientFeedback(null); } catch (Exception ex) { Log.Error("Error in AdminController/WhatClientSays", ex); throw ex; } return(View(feedback)); }
public ActionResult WhatClientSaysDetail(int id) { WhatClientSays feedback = new WhatClientSays(); IAdminBL adminBL = new AdminEngine(); try { feedback = adminBL.GetSingleClientFeedback(id); } catch (Exception ex) { Log.Error("Error in AdminController/WhatClientSaysDetail", ex); throw ex; } return(Json(feedback, JsonRequestBehavior.AllowGet)); }
public ActionResult WhatClientSays() { List <WhatClientSays> feedback = new List <WhatClientSays>(); IAdminBL adminBL = new AdminEngine(); try { feedback = adminBL.GetClientFeedback(null); feedback = feedback.Where(x => x.is_published).ToList(); } catch (Exception ex) { throw ex; } return(View(feedback)); }
public ActionResult AllPostRequirement(string title = null) { List <PostYourRequirement> postRequirement = new List <PostYourRequirement>(); IAdminBL adminBL = new AdminEngine(); try { int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]); postRequirement = adminBL.GetAllPostRequirement(title); } catch (Exception ex) { Log.Error("Error in AdminController/AllPostRequirement", ex); throw ex; } return(View(postRequirement)); }
private void addBtn_Click(object sender, EventArgs e) { int artistId = Convert.ToInt32(availableArtistsView.CurrentRow.Cells[0].Value); int sceneId = Convert.ToInt32(availableScenesView.CurrentRow.Cells[0].Value); DateTime concertDate = concertDateSelect.Value; bool success = false; string message; success = AdminEngine.AddConcert(concertDate, sceneId, artistId, out message); if (success) { MessageBox.Show(message); } else { MessageBox.Show(message); } }
private void cancelConcertBtn_Click(object sender, EventArgs e) { var concertId = Convert.ToString(comingConcertsView.CurrentRow.Cells[0].Value); bool giveCoupons = couponsCheckBox.Checked; var success = AdminEngine.CancelConcert(concertId, giveCoupons); if (success) { string message = "Concert deleted and ticket-money refunded"; if (giveCoupons) { message += " and coupons granted"; } MessageBox.Show(message); AdminStartPage start = new AdminStartPage(); this.Hide(); start.Show(); } else { MessageBox.Show("Something went wrong"); } }
public JsonResult Search(UserData filters) { AEngine = new AdminEngine(); //var resultsJson = AEngine.SearchStudent(filters); return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Create the order /// </summary> /// <param name="currentUser"></param> public void CreateOrder(ApplicationUser currentUser) { //start by getting the current user AdminEngine adminEngine = new AdminEngine(); //// && System.Web.HttpContext.Current.User.IsInRole("user") string user = System.Web.HttpContext.Current.User.Identity.Name; //var store = new UserStore<ApplicationUser>(new ApplicationDbContext()); //store.AutoSaveChanges = false; //var currentUserId = User.Identity.GetUserId(); //var manager = new UserManager<ApplicationUser>(store); //var currentUser = manager.FindById(User.Identity.GetUserId()); //currentUser.MyUserInfo = new MyUserInfo(); //extractCartItems(); using (var context = new EntityMappingContext()) { //Session["Error"] = m_items; //Response.Redirect("/UserPages/ErrorPage.aspx"); m_items = GetCartItems(); //lists to store ids and quantity respectively m_listIds = new List <int>(); m_listQuantity = new List <int>(); //fill order items - from the cart //get just the product id and the quantity. The rest I search for for (int i = 0; i < m_items.Count; i++) { m_orderItem = new OrderItem() { // OrderId = order.OrderId, ProductId = m_items[i].ProductId, Quantity = m_items[i].Quantity, Price = m_items[i].Product.UnitPrice, ItemName = m_items[i].Product.ProductName, Specs = m_items[i].Product.Specifications, }; //add items and their corresponding id m_listIds.Add(m_items[i].ProductId); m_listQuantity.Add(m_items[i].ProductId); //Product Data m_ProductName += Environment.NewLine + m_items[i].Product.ProductName + ","; // drop lines m_orderQuantity += m_items[i].Quantity; m_ProductPrice = Convert.ToDouble(m_items[i].Product.UnitPrice); m_Subtotal += m_items[i].Quantity * Convert.ToDouble(m_items[i].Product.UnitPrice); m_Total = m_Subtotal * 1.25; try { // Add OrderDetail to DB. ctx.OrderItems.Add(m_orderItem); ctx.SaveChanges(); } catch (Exception ex) { HttpContext.Current.Session["Error"] = ex; HttpContext.Current.Response.Redirect("ErrorPage.aspx"); } } HttpContext.Current.Session["m_listIds"] = m_listIds; HttpContext.Current.Session["m_listQuantity"] = m_listQuantity; //Generate Order Confirmation OrderConfirmation orderConfirmation = new OrderConfirmation() { CustomerName = currentUser.MyUserInfo.FirstName, CustomerMiddle = currentUser.MyUserInfo.MiddleName, CustomerLast = currentUser.MyUserInfo.LastName, CustomerPhone = currentUser.MyUserInfo.Telephone, CustomerCell = currentUser.MyUserInfo.Cellphone, CustomerEmail = currentUser.MyUserInfo.Email, BillingAddressName = currentUser.BillingAddress.AddressName, BillingAddressNo = currentUser.BillingAddress.AddressNumber, BillingApartment = currentUser.BillingAddress.Apartment, BillingStair = currentUser.BillingAddress.Stair, BillingZipCode = currentUser.BillingAddress.Zipcode, BillingCity = currentUser.BillingAddress.City, BillingCountry = currentUser.BillingAddress.Country, ShippingAddressName = currentUser.ShippingAddress.AddressName, ShippingAddressNo = currentUser.ShippingAddress.AddressNumber, ShippingApartment = currentUser.ShippingAddress.Apartment, ShippingStair = currentUser.ShippingAddress.Stair, ShippingZipCode = currentUser.ShippingAddress.Zipcode, ShippingCity = currentUser.ShippingAddress.City, ShippingCountry = currentUser.ShippingAddress.Country, ////Product Data ProductName = m_ProductName, Quantity = m_orderQuantity, ProductSpec = m_orderItem.Specs, Subtotal = m_Subtotal, Total = m_Total, //Payment Data - Credit Card CCardName = currentUser.MyUserCCardInfo.CardName, CCardNo = currentUser.MyUserCCardInfo.CardNumber, CCArdExpiryDate = currentUser.MyUserCCardInfo.CardExpiryDate, CCardSecurityCode = currentUser.MyUserCCardInfo.CardSecurityCode, }; //for (int i = 0; i < m_items.Count; i++) //{ // //instantiate orderEngine to access GetLineItem method // OrderEngine orderEngine = new OrderEngine(); //get the item list //List<LineItem> itemList = orderEngine.GetLineItems(); //create order m_order = new Order() { Created = DateTime.Now.ToString(), BillingAddress = orderConfirmation.BillingAddress, ShippingAddress = orderConfirmation.ShippingAddress, CustomerName = currentUser.UserName, Total = orderConfirmation.Total, }; //} //Generate invoice Invoice invoice = new Invoice() { SubTotal = m_orderItem.Price, Tax = 0.25, Total = (m_orderItem.Price * (0.25)) + m_orderItem.Quantity, // BillingAddress = billingAddress, }; //initialize type to avoid nulle refference //CreateAddress Address billingAddress = new Address() { //Address part StreetName = currentUser.BillingAddress.AddressName, StreetNo = currentUser.BillingAddress.AddressNumber, City = currentUser.BillingAddress.City, Country = currentUser.BillingAddress.Country, ZipCode = currentUser.BillingAddress.Zipcode, }; //Create customer Customer customer = new Customer() { FirstName = currentUser.MyUserInfo.FirstName, MiddleName = currentUser.MyUserInfo.MiddleName, LastName = currentUser.MyUserInfo.LastName, Phone = currentUser.MyUserInfo.Telephone, CellPhone = currentUser.MyUserInfo.Cellphone, Email = currentUser.MyUserInfo.Email //BillingAddress = billingAddress }; //add delivery address Address deliveryAddress = new Address() { //Address part StreetName = currentUser.ShippingAddress.AddressName, StreetNo = currentUser.ShippingAddress.AddressNumber, City = currentUser.ShippingAddress.City, Country = currentUser.ShippingAddress.Country, ZipCode = currentUser.ShippingAddress.Zipcode, }; //Shippment Shippment shipment = new Shippment() { State = "Not shipped", AddresName = currentUser.ShippingAddress.AddressName, AddressNo = currentUser.ShippingAddress.AddressNumber, AddresApt = currentUser.ShippingAddress.Apartment, AddresStair = currentUser.ShippingAddress.Stair, Country = currentUser.ShippingAddress.Country, City = currentUser.ShippingAddress.City, ZipCode = currentUser.ShippingAddress.Zipcode, }; try { ctx.OrderConfirmations.Add(orderConfirmation); ctx.Orders.Add(m_order); // ctx.LineItems.Add(m_lineItem); // Add OrderDetail to DB. ctx.Invoices.Add(invoice); ctx.Customers.Add(customer); ctx.Addresses.Add(billingAddress); ctx.Shipments.Add(shipment); ctx.SaveChanges(); // Prepare for the items to be saved. this is used to display the line items List <CartItem> orderDetailList = GetCartItems(); // Add OrderDetail information to the DB for each product purchased. for (int i = 0; i < orderDetailList.Count; i++) { // Create a new OrderDetail object. m_lineItem = new LineItem(); m_lineItem.OrderId = m_order.OrderId; m_lineItem.UserName = currentUser.UserName; m_lineItem.ProductID = orderDetailList[i].ProductId; m_lineItem.ProductName = orderDetailList[i].Product.ProductName; m_lineItem.Quantity = orderDetailList[i].Quantity; m_lineItem.UnitPrice = orderDetailList[i].Product.UnitPrice; ctx.LineItems.Add(m_lineItem); ctx.SaveChanges(); } m_lastOrderId = m_order.OrderId; HttpContext.Current.Session["lastId"] = m_lastOrderId; m_lastOrderConfirmationId = orderConfirmation.OrderConfirmationId; HttpContext.Current.Session["lastOrderConfId"] = m_lastOrderConfirmationId; //validate ctx.Configuration.ValidateOnSaveEnabled = true; } catch (DbEntityValidationException ex) { var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); // Join the list to a single string. var fullErrorMessage = string.Join("; ", errorMessages); // Combine the original exception message with the new one. var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage); HttpContext.Current.Session["Error"] = fullErrorMessage; HttpContext.Current.Response.Redirect("/UserPages/ErrorPage.aspx"); // Throw a new DbEntityValidationException with the improved exception message. throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors); } finally { //orderId var orderId = ctx.Orders.OrderByDescending(myorder => myorder.OrderId).FirstOrDefault(); OrderEngine orderEngine = new OrderEngine(); //Change the status or the order var anorder = (from myorder in ctx.Orders where myorder.OrderId == m_lastOrderId // get the corresponding order select myorder).First(); // this will fetch the record. anorder.Submitted = DateTime.Now.ToString(); ctx.SaveChanges(); } ////reset the cart for next order //// cartEngine.ZeroCart(); // EmptyCart(); //HttpContext.Current.Response.Redirect("/UserPages/Products.aspx"); }//end EntityMappingContext }
private void CouponOvervBtn_Click(object sender, EventArgs e) { List <ClassLibrary.CouponInfoAdmin> coupons = AdminEngine.CouponOverview(); statisticsView.DataSource = coupons; }
private void TopArtistsBtn_Click(object sender, EventArgs e) { List <TopArtistView> topArtistList = AdminEngine.FindTopTenArtists(dateTimePickerFrom.Value, dateTimePickerTo.Value); statisticsView.DataSource = topArtistList; }
/// <summary> /// Provide behavior for checkout button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCheckOut_Click(object sender, EventArgs e) { EntityMappingContext ctx = new EntityMappingContext(); //instantiate store engine to get cart items ShoppingCartEngine cartEngine = new ShoppingCartEngine(); //create an order status object in order to set it to submitted OrderStatus orderstatus = ctx.OrderStatuses.Create(); //get the cart items List <CartItem> cartItemList = cartEngine.GetCartItems(); // Session["CartItems"] = cartItemList; orderstatus.Status = "Created " + DateTime.Now.ToString(); //Session["Error"] = orderstatus.Status; //Response.Redirect("/UserPages/ErrorPage.aspx"); try { ctx.OrderStatuses.Add(orderstatus); ctx.SaveChanges(); //validate ctx.Configuration.ValidateOnSaveEnabled = true; } catch (DbEntityValidationException ex) { var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); // Join the list to a single string. var fullErrorMessage = string.Join("; ", errorMessages); // Combine the original exception message with the new one. var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage); Session["Error"] = fullErrorMessage; Response.Redirect("ErrorPage.aspx"); // Throw a new DbEntityValidationException with the improved exception message. throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors); } //now deal with registering the user's data. If he / she is not registered //He will be prompted to register, otherwise he will proceed to simply checkout AdminEngine adminEngine = new AdminEngine(); //// && System.Web.HttpContext.Current.User.IsInRole("user") //&& System.Web.HttpContext.Current.User.IsInRole("Customer") string user = System.Web.HttpContext.Current.User.Identity.Name; var store = new UserStore <ApplicationUser>(new ApplicationDbContext()); store.AutoSaveChanges = false; var currentUserId = User.Identity.GetUserId(); var manager = new UserManager <ApplicationUser>(store); var currentUser = manager.FindById(User.Identity.GetUserId()); //if the current user is null he is not authenticated if (!(currentUser == null)) { //If the object to be checked is null create it if (currentUser.MyUserCCardInfo == null) { //creating object currentUser.MyUserCCardInfo = new MyUserCCardInfo(); //go to enter data Response.Redirect("~/UserPages/EnterUserData.aspx"); } else { //If the credit card number is not null the record exists //and just confirmation is required if (!(currentUser.MyUserCCardInfo.CardNumber == null)) { //Create order shoppingCart.CreateOrder(currentUser); //go to confirm Response.Redirect("~/Secure/UserPagesSecured/ConfirmOrder.aspx"); } else { //if not then enter user data Response.Redirect("~/UserPages/EnterUserData.aspx"); } } } //if the user is not authenticated then make sure he is logged out and send him to login else { var authenticationManager = HttpContext.Current.GetOwinContext().Authentication; authenticationManager.SignOut(); HttpContext.Current.Response.Redirect("~/Account/Login.aspx"); } //check if the credit card number is null if not then just confirm if (!(currentUser.MyUserCCardInfo.CardNumber == null)) { //Create order shoppingCart.CreateOrder(currentUser); //go to confirm Response.Redirect("~/Secure/UserPagesSecured/ConfirmOrder.aspx"); } //if the user name is null then login if (user == null) { HttpContext.Current.Response.Redirect("~/Account/Login.aspx"); } }