public ActionResult GiftCardEdit() { if (!string.IsNullOrEmpty(Session["username"] as string)) { if (Session["roleid"].ToString() == "1" || Session["roleid"].ToString() == "5") { try { CustomerServiceData csd = new CustomerServiceData(); List <GiftCard> giftCards = csd.GetGiftCardData(); Header header = csd.GetHeaderData()[2]; ViewBag.Header = header; return(View(giftCards)); } catch (Exception ex) { return(View("Error", ex)); } } else { return(View("Accessdenied")); } } else { return(RedirectToAction("Index", "Login")); } }
public string Print() { CustomerServiceData csd = new CustomerServiceData(); CustomerService customerService = csd.GetCustomerServiceData(); string s = new PageOrientations().RenderRazorViewToString(this, "Print", customerService); return(s); }
public ActionResult Index() { if (!string.IsNullOrEmpty(Session["username"] as string)) { try { CustomerServiceData csd = new CustomerServiceData(); CustomerService customerService = csd.GetCustomerServiceData(); return(View(customerService)); } catch (Exception ex) { return(View("Error", ex)); } } else { return(RedirectToAction("Index", "Login")); } }
public ActionResult SocialMediaEdit(FormCollection form) { if (!string.IsNullOrEmpty(Session["username"] as string)) { try { List <SocialMedia> lst = new List <SocialMedia>(); for (int i = 1; i <= 2; i++) { SocialMedia obj = new SocialMedia(); obj.Month1 = form["Month1" + i]; obj.Month2 = form["Month2" + i]; obj.Year2 = form["Year2" + i]; obj.Change1 = form["Change1" + i]; obj.Change2 = form["Change2" + i]; lst.Add(obj); } Header header = new Header(); header.Month1 = !string.IsNullOrEmpty(form["Month1"]) ? form["Month1"] : string.Empty;; header.Month2 = !string.IsNullOrEmpty(form["Month2"]) ? form["Month2"] : string.Empty;; header.Year1 = !string.IsNullOrEmpty(form["Year1"]) ? form["Year1"] : string.Empty; header.Year2 = !string.IsNullOrEmpty(form["Year2"]) ? form["Year2"] : string.Empty; header.Year3 = !string.IsNullOrEmpty(form["Year3"]) ? form["Year3"] : string.Empty; header.Year4 = "2019"; CustomerServiceData csd = new CustomerServiceData(); csd.UpdateSocialMediaData(lst, header); return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error", ex)); } } else { return(RedirectToAction("Index", "Login")); } }
public bool BuildAndImplementCustomService(CustomerServiceDataEntity customerService, string sessionIdentifier) { // Verificar argumentos if (customerService == null) { throw new ArgumentException("Invalid null argument. Must provide an instance of DataModelEntity.", "customerService"); } if (sessionIdentifier == null) { throw new ArgumentException("Invalid null argument.", "sessionIdentifier"); } // Verificar si el servicio es válido CustomerServiceData customerServiceLogic = new CustomerServiceData(); if (!customerServiceLogic.Validate(customerService)) { throw new ArgumentException("Provided customer service is not valid.", "customerService"); } // Si el servicio ya está desplegado, lanzar un error if (customerService.Service == null) { // Si el servicio no fue cargado, cargarlo Service serviceLogic = new Service(); customerService.Service = serviceLogic.GetService(customerService.IdService, false, sessionIdentifier); } if (customerService.Service.Deployed) { throw new FaultException(Resources.CustomerServiceAlreadyDeployed); } // El modelo de datos asociado debe ser desplegado if (!customerService.DataModel.Deployed) { throw new FaultException(Resources.DataModelMustBeDeployed); } ConsoleWriter.SetText("Building custom service."); // Carga el contenedor del servicio LoadService(customerService, sessionIdentifier); // Construir el programa Meta D++ string fileName = BuildMetaDppProgramForCustomerService(customerService, false); string clientVersionFileName = BuildMetaDppProgramForCustomerService(customerService, true); // Intentar transferir el servicio si está activo if (ServerHost.Instance.StopCustomService(Path.GetFileNameWithoutExtension(fileName))) { try { File.Delete(Path.ChangeExtension(fileName, ".dll")); File.Delete(Path.ChangeExtension(clientVersionFileName, ".dll")); } catch { Debug.WriteLine("Old services files couldn´t be deleted."); } // Compilar el programa Meta D++ if (CompileMetaDppProgram(new Uri(fileName), false)) { // Construir la versión móvil del servicio de infraestructura if (CompileMetaDppProgram(new Uri(clientVersionFileName), true)) { ConsoleWriter.SetText("Building custom service successful."); Debug.WriteLine("Custom Service Dll for Mobile succeful builded."); fileName = Path.ChangeExtension(fileName, ".dll"); clientVersionFileName = Path.ChangeExtension(clientVersionFileName, ".dll"); SaveCustomServiceModel(customerService, fileName, clientVersionFileName, sessionIdentifier); // Inciar el servicio web return(PublishCustomService(fileName)); } else { Debug.WriteLine("Error building Custom Service Dll for Mobile."); } } } return(false); }