public ActionResult Remove(FormCollection form) {
            if (!Services.Authorizer.Authorize(Orchard.Themes.Permissions.ApplyTheme, T("Cannot manage themes")))
                return new HttpUnauthorizedResult();

            var id = int.Parse(form.GetKey(0).Substring(1));
            _settingsService.Remove(id);

            return RedirectToAction("Index");
        }
        public static bool ConvertAllToUpper(ref FormCollection collection)
        {
            try
            {
                for (int index = 0; index < collection.Count; index++)
                    collection.Set(collection.GetKey(index), collection.Get(index).ToString().ToUpper());

                return true;
            }
            catch
            {
                return false;
            }
        }
Esempio n. 3
0
        public ActionResult Index(CartViewModel model, FormCollection form)
        {
            var cart = Session["Cart"] as Cart;
            if (cart == null)
                return RedirectToAction("Index", "Home");

            var resultModel = new CartViewModel {Cart = new Cart()};
            try
            {
                if (form.Keys.Count != 0)
                    for (int i = 0; i < form.Keys.Count; ++i)
                    {
                        var name = form.GetKey(i);
                        if (name.Contains("delete_all"))
                        {
                            GetCart().Clear();
                            Session["Cart"] = null;
                            ViewBag.IsAddToCart = null;
                            ViewBag.CartIsEmpty = true;
                            return RedirectToAction("Index", "Home");
                        }
                    }
            }
            catch (Exception)
            {
                return RedirectToAction("Index");
            }

            if (!OrderService(cart, resultModel))
                return RedirectToAction("Finality", "Error", new
                    {
                        action = Auxiliary.Actions.Purchase,
                        result = Auxiliary.Result.Error
                    });

            Session["BoughtProducts"] = resultModel;
            Session["Cart"] = null;
            return RedirectToAction("Success", "Purchase");
        }
Esempio n. 4
0
        public Message SaveControlToDB(FormCollection form, PerformanceReview pr, bool isInsert)
        {
            Message msg = null;
            List<EForm_Detail> detailList = new List<EForm_Detail>();
            string EformID = form.Get("Hidden1");

            for (int i = 0; i < form.Count; i++)
            {
                string controlID = form.GetKey(i);
                bool flag = false;
                foreach (String str in control)
                {
                    if (controlID.StartsWith(str))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    CRM.Models.EForm_Detail detailItem = new Models.EForm_Detail();
                    string value = form.Get(controlID);
                    if (controlID.StartsWith("CheckBox"))
                    {
                        value = value.Split(Convert.ToChar(","))[0];
                    }
                    detailItem.ControlID = controlID;
                    detailItem.Value = value;
                    detailItem.EFormID = Int32.Parse(EformID);
                    detailList.Add(detailItem);

                }
            }
            CRM.Models.EformDao efDao = new EformDao();
            msg = isInsert == true ? efDao.Inser(detailList, pr) : efDao.Update(detailList, pr);

            return msg;
        }
Esempio n. 5
0
        public ActionResult ProductsList(Cart model, FormCollection form)
        {
            if (form.Keys.Count != 0) // if input exists
            {
                for (var i = 0; i < form.Keys.Count; ++i)
                {
                    string name = form.GetKey(i);
                    if (name.Contains("delete"))
                    {
                        var id = name.Substring(name.IndexOf('_') + 1, name.Length - 1 - name.IndexOf('_'));
                        var product = _dataManager.Products.GetProductById(Convert.ToInt32(id));

                        GetCart().RemoveItem(product);
                        if (GetCart().IsEmpty)
                        {
                            ViewBag.IsAddToCart = null;
                            Session["Cart"] = null;
                        }
                        else
                        {
                            Session["Cart"] = GetCart();
                        }
                        break;
                    }
                }
            }

            if (Session["Cart"] == null)
            {
                ViewBag.CartIsEmpty = true;
                return View("ProductsList", null);
            }

            return View("ProductsList", new CartViewModel
                {
                    Cart = GetCart()
                });
        }
Esempio n. 6
0
        public ActionResult Index(CreateProduct model, FormCollection form, HttpPostedFileBase uploadImage)
        {
            if (form.GetKey(form.Keys.Count - 1) == "delete") // if input 'delete' stands always in the end
            {
                if (_dataManager.Products != null)
                    return Redirect(Auxiliary.Actions.Delete, DeleteProduct(model)
                        ? Auxiliary.Result.OperationSuccess : Auxiliary.Result.Error);
            }
            else
            {
                if (!ModelState.IsValid)
                    return View(model);
                if (_dataManager.Products != null)
                {
                    var oldProduct = _dataManager.Products.GetProductById(model.Id);
                    if (oldProduct == null)
                        return RedirectToAction("Pity", "Error");

                    var item = new Product();
                    ReadModel(model, item);
                    item.Id = (int) Session["CurrentProductId"];

                    if (uploadImage != null)
                        ReadImage(uploadImage, item);
                    else
                        item.Image = oldProduct.Image;

                    if (_dataManager.Products != null)
                        if (UpdateProduct(item, model))
                            return Redirect(Auxiliary.Actions.Delete,
                                _dataManager.ProductsCustomers.UpdateProdCastRelation(item.Id, model.Count)
                                ? Auxiliary.Result.OperationSuccess : Auxiliary.Result.Error);
                }
            }
            return View(model);
        }
        //for training
        public ActionResult TrainData(FormCollection form)
        {
            string[] Answers2= new string[92] { "0True", "1True", "2True", "3True", "4True", "5False", "test", "7False", "8False", "9very little", "10False", "11False", "12at the end", "13very little to no time", "14False", "15False", "16Fast", "17False", "18Less than a Year", "19False", "20Every 1-3 weeks", "21Every 1-3 weeks", "22False", "23False", "24False", "25very", "26True", "27very", "28False", "29False", "30little", "31little", "32average amount", "33love it", "34False", "35spread out across country", "36low - Medium", "37High", "38False", "39False", "40True", "41False", "42False", "43low", "44True", "45One", "46False", "47True", "48True", "49True", "50None", "51True", "52True", "53False", "54Medium", "55True", "56True", "57False", "58False", "59False", "60Updated Often", "61False", "62False", "63False", "64Low Budget", "65Low Budget", "66Low Budget", "67Low Budget", "68False", "69False", "70False", "71Small", "72True", "73False", "74Flexable", "75True", "76True", "77True", "78True", "79True", "80True", "81True", "82True", "83True", "84False", "85False", "86False", "87False", "88True", "89False", "90False", "91False" };
            Debug.Print("Answers2: " +Answers2.Length.ToString());
            Debug.Print("Train COUNT IN CONTROLLER");
            string[] Answers = new string[form.Count]; //for now hard code it
            Debug.Print("Form length is: " + form.Count.ToString());
            form.CopyTo(Answers, 0);
            for(int i=0; i<Answers.Length; i++)
            {
                Debug.Write(Answers[i]+", ");
            }
            Debug.Print("Length of form is: ");
            Debug.Print(Answers.Length.ToString());
            if (Answers.Length==93) //if all the questions were answered
            {
                string winner = form[form.Count - 1];
                //Debug.Print("winner: " + winner);
                string key= form.GetKey(form.Count-1);
                form.Remove(form.GetKey(form.Count - 1));//hopefully removing the winner from the form
                Answers = new string[form.Count];
                form.CopyTo(Answers, 0);
                string[] OldAnswers = new string[form.Count];
                Answers.CopyTo(OldAnswers, 0);
                PModel.Answers = PModel.RemoveQuestionIDS(Answers);
                /*Debug.Print("Answers Again: ");
                for (int i = 0; i < Answers.Length; i++) //test
                {
                    Debug.Write(Answers[i] + ",");
                }*/
                int score =PModel.TrainData(winner);

                ViewData["isValid"] = "true";
                ViewData["answers"] = OldAnswers;
                ViewData["questions"] = PModel.Questions;
                ViewData["multAnswers"] = PModel.MultipleChoiceAnswers;
                ViewData["result"] = winner + " has been added to the database with a score of " + score.ToString();
                return View("TrainingData");
            }
            else
            {
                ViewData["questions"] = PModel.Questions;
                ViewData["multAnswers"] = PModel.MultipleChoiceAnswers;
                ViewData["isValid"] = "false";
                ViewData["answers"] = Answers;
                ViewData["result"] = "";
                return View("TrainingData");
            }
        }
Esempio n. 8
0
 public JsonResult SaveRoles(FormCollection form)
 {
     var usr = Membership.GetUser(form[1]);
     int count;
     if (usr != null && Int32.TryParse(form[0], out count))
     {
         count += 2;
         for (int i = 2; i < count; i++)
         {
             if (form[i].Equals("true", StringComparison.InvariantCultureIgnoreCase))
             {
                 if (!Roles.IsUserInRole(usr.UserName, form.GetKey(i))) { Roles.AddUserToRole(usr.UserName, form.GetKey(i)); }
             }
             else
             {
                 if (Roles.IsUserInRole(usr.UserName, form.GetKey(i))) { Roles.RemoveUserFromRole(usr.UserName, form.GetKey(i)); }
             }
         }
         return Json(true);
     }
     return Json(false);
 }
Esempio n. 9
0
        public ActionResult Create(FormCollection form)
        {
            if (ModelState.IsValid)
            {
                //db.Encabezado_Factura.Add(encabezado_Factura);
                //db.SaveChanges();
                //return RedirectToAction("Index");
            }

            int idCliente = Convert.ToInt32(form["ID_cliente"]);
            string documento = form["Cliente.Documento"];
            string tipoDocumento = form["Cliente.TipoResponsables.Descripcion"];
            int CondicionIVA = Convert.ToInt32(form["iva"]);

            double desc_Iva;
            if (CondicionIVA <= 2)
            {
                desc_Iva = 0;
            }
            else
            {
                string descripcion = db.CondicionIVA.Where(m => m.Codigo == CondicionIVA).FirstOrDefault().Descripcion;
                desc_Iva = Convert.ToDouble(descripcion.Replace('%', ' '));
                desc_Iva =  Math.Round(desc_Iva, 2);
            }

            string ID_condicion_venta = form["ID_condicion_venta"];
            // DateTime FechaEmision = Convert.ToDateTime(form["Fecha"]);
            //int Remito = Convert.ToInt32(form["Nro_remito"]);
            int OrdenCompra = Convert.ToInt32(form["OrdenCompra"]);
            int DiasFF = Convert.ToInt32(form["Cliente.DiasFF"]);
            int DiasCheque = Convert.ToInt32(form["Cliente.Dias_Cheque"]);
            Decimal Descuento = Convert.ToDecimal(form["Descuento"].Replace('.', ','));
            Double subtotal = Convert.ToDouble(form["subtotal"].Replace('.', ','));
            Double total = Convert.ToDouble(form["total"].Replace('.', ','));

            List<itemFactura> itemsFactura = new List<itemFactura>();
            for (int i = 10; i < form.Count - 2; i = i + 4)
            {
                itemFactura item = new itemFactura
                {
                    IdArticulo = Convert.ToInt32(form[form.GetKey(i)]),
                    cantidad = Convert.ToDecimal(form[form.GetKey(i + 1)]),
                    precioUnitario = Convert.ToDecimal(form[form.GetKey(i + 2)]),
                    precioTotal = Convert.ToDecimal(form[form.GetKey(i + 3)])
                };
                itemsFactura.Add(item);
            }

            //Consdigo autoriazcion en AFIP para generar factura
            DetalleRegistros[] detalles = new DetalleRegistros[1];

            DetalleRegistros det = new DetalleRegistros();

            //el nro de comproabnte lo obtiene la libreria
            //Si no se le envia fecha de comprobante Afip asigna la fecha del proceso
            //det.CbteFch = FechaEmision.ToString("yyyy-MM-dd");

            det.Concepto = 1; //1=Productos
            det.DocNro = Convert.ToInt64(documento);
            det.DocTipo = 80; //80=CUIT
            det.ImpTotal = Math.Round(total, 2); 
            det.ImpNeto = Math.Round(subtotal,2);
            det.ImpTotConc = 0;
            det.ImpOpEx = 0;
            det.ImpTrib = 0;
            det.ImpIVA = Math.Round(subtotal * (desc_Iva / 100), 2);  //
            det.MonId = "PES"; //peso
            det.MonCotiz = 1; //moneda argetnia es 1

            if (CondicionIVA >= 3 && CondicionIVA <= 6)
            {
                Blibox.Logica.Model.IVA[] iva = new Blibox.Logica.Model.IVA[1];
                iva[0] = new Blibox.Logica.Model.IVA();
                iva[0].Id = CondicionIVA; //21%
                iva[0].BaseImp = subtotal;
                iva[0].Importe = subtotal * (desc_Iva / 100);

                det.Iva = iva;
            }

            detalles[0] = det;

            
            FECAERespuesta resp = FE.AutorizacionFactura(1, 1, 001, detalles);



            if (resp.Cabecera.Resultado == "A")
            {
                DateTime fechaVencCAE = DateTime.ParseExact(resp.Detalles[0].CAEFchVto, "yyyyMMdd", null);

                Encabezado_Factura encFactura = new Encabezado_Factura
                {
                    CAE = resp.Detalles[0].CAE,
                    Descuento = Descuento,
                    Fecha = DateTime.Now,
                    FechaVencimientoCAE = fechaVencCAE,
                    ID_cliente = idCliente,
                    ID_condicon_venta = Convert.ToInt32(ID_condicion_venta),
                    IVA = Convert.ToDecimal(desc_Iva),
                    NroComprobante = Convert.ToInt32(resp.Detalles[0].CbteDesde),
                    Nro_remito = 0,
                    OrdenCompra = OrdenCompra,
                    Subtotal = Convert.ToDecimal(subtotal),
                    Total = Convert.ToDecimal(total),
                    Tipo = "1", //1=Factura A

                };


                List<Detalle_factura> detFactura = new List<Detalle_factura>();
                int id_item = 1;
                foreach (itemFactura item in itemsFactura)
                {
                    Detalle_factura newDet = new Detalle_factura
                    {
                        Cantidad = item.cantidad,
                        ID_articulo = item.IdArticulo,
                        Precio_unitario = item.precioUnitario,
                        Precio_total = item.precioTotal,
                        ID_item = id_item
                    };

                    detFactura.Add(newDet);
                    id_item++;


                };

                encFactura.Detalle_factura = detFactura;

                db.Encabezado_Factura.Add(encFactura);
                db.SaveChanges();


                // ViewBag.ID_cliente = new SelectList(db.Cliente, "ID_cliente", "Razon_Social", encabezado_Factura.ID_cliente);
                return RedirectToAction("Index");
                //return View(form);
            }
            else
            {
                // fue rechazada ver que hacer
                foreach(Error err in resp.Errores)
                {
                    HelperController.Instance.agregarMensaje("Error "+err.Codigo+" - "+err.Mensaje, HelperController.CLASE_ERROR);
                }
            }

            //return View(form);
            ViewBag.ID_cliente = new SelectList(db.Cliente, "ID_cliente", "Razon_Social");
            ViewBag.CondicionVenta = new SelectList(db.Condicion_venta, "ID_condicion_venta", "Descripcion");
            ViewBag.CondicionIVA = new SelectList(db.CondicionIVA, "Codigo", "Descripcion", "5");
            ViewBag.art = "";
            return View(new Encabezado_Factura());
        }
        public ActionResult Find(FormCollection fm)
        {
            bool sendRequest = true;
            if (SessionHandler.Logon)
            {

                try
                {
                    HeartbeatMonitor loginTimer = new HeartbeatMonitor(SessionHandler.UID, HttpContext);
                    //display a list of users not including the active user
                    int temp = Convert.ToInt32(fm.GetKey(0));

                    FriendsList friend = (from f in db.FriendsLists
                                          where f.id == SessionHandler.UID && f.friend_id == temp
                                          select f).FirstOrDefault();

                    if (friend != null)
                    {
                        if (friend.num_requests_sent < 10)
                        {
                            int i = friend.num_requests_sent;
                            friend.num_requests_sent = ++i;
                            friend.status = "pending";
                        }
                        else
                        {
                            sendRequest = false;
                        }
                    }
                    else
                    {
                        // Add a request to the friends list table
                        FriendsList fl = new FriendsList();
                        fl.id = SessionHandler.UID;
                        fl.friend_id = temp;
                        fl.num_requests_sent = 1;
                        fl.status = "pending";

                        db.FriendsLists.Add(fl);
                    }

                    if (sendRequest)
                    {
                        // get current users information
                        User c_user = (from userT in db.Users
                                       where userT.id == SessionHandler.UID
                                       select userT).FirstOrDefault();

                        // current users image
                        string userImage = c_user.image_url;

                        //send friend request message to the select user in find friends form.
                        UserMessage um = new UserMessage();

                        // current date and time, when message was sent
                        um.datetime_sent = DateTime.Now;

                        //this is the ID of the current logged in user
                        um.sender_id = SessionHandler.UID;

                        //This is the ID of the user, who is being sent the friend request.
                        um.recipient_id = temp;
                        um.subject = "Friend Request";
                        um.message = "<table><tr>" +
                            "<tdborder=\"0px\"> <img src=\"" + "../" + userImage + "\" height=\"50px\" width=\"45px\"/> </td>" +
                            "<td>" + c_user.firstname + " " + c_user.lastname + " has sent you a friend request. </td>" +
                            "<td><a href=\"../../../FriendList/AcceptRequest/?friendID=" + SessionHandler.UID + "&userID=" + temp + "\">Accept</a></td>" +
                            "<td><a href=\"../../../FriendList/DeclineRequest/?friendID=" + SessionHandler.UID + "&userID=" + temp + "\">Decline</a></td>" +
                            "</tr></table>";
                        um.message_read = false;

                        // add the message to the user messages table
                        db.UserMessages.Add(um);

                        // save the changes made to the database.
                        db.SaveChanges();
                    }

                    // Redirect to specified view
                    return RedirectToAction("Find", "FriendList");

                }
                catch (Exception ex)
                {
                    return View("~/Views/Shared/Error.cshtml", ex);
                }
            }
            else
            {
                //must go to the login action
                return RedirectToAction("Index", "Login");
            }
        }
        public ActionResult Edit(FormCollection fm)
        {
            if (SessionHandler.Logon)
            {
                try
                {
                    HeartbeatMonitor loginTimer = new HeartbeatMonitor(SessionHandler.UID, HttpContext);
                    int friendID = Convert.ToInt32(fm.GetKey(0));

                    var fr = (from f in db.FriendsLists
                              where f.id == SessionHandler.UID && f.friend_id == friendID
                              select f).FirstOrDefault();
                    if (fr != null)
                    {
                        db.FriendsLists.Remove(fr);
                    }

                    fr = (from f in db.FriendsLists
                          where f.id == friendID && SessionHandler.UID == f.friend_id
                          select f).FirstOrDefault();

                    if (fr != null)
                    {
                        db.FriendsLists.Remove(fr);
                    }

                    db.SaveChanges();

                    List<int> friends = (from friendslist in db.FriendsLists
                                         where friendslist.id == SessionHandler.UID && friendslist.status.Equals("accepted")
                                         select friendslist.friend_id
                                   ).ToList();
                    ViewBag.Message = "Click \"Remove\" to remove any friends";

                    if (friends != null)
                    {

                        foreach (var friend in friends)
                        {
                            User u = (from user in db.Users
                                      where friend.Equals(user.id)
                                      select user).FirstOrDefault();
                            list.Add(u);
                        }

                        return View("EditFriendList", list);
                    }
                    else
                    {
                        return View("EditFriendList");
                    }

                }
                catch (Exception ex)
                {
                    return View("~/Views/Shared/Error.cshtml", ex);
                }
            }
            else
            {
                //must go to the login action
                return RedirectToAction("Index", "Login");
            }
        }
        public ActionResult saveResult(FormCollection c)
        {
            if (Session["id"] == null)
                return RedirectToAction("signin", "Home");
            for (int i = 0; i < c.Count; i++)
            {
                result obj = new result();

                string str = c.GetKey(i);
                var res = str.Split(';');
                obj.studentId = Convert.ToInt32(res[0]);
                obj.csId = Convert.ToInt32(res[1]);
                obj.examId = Convert.ToInt32(res[2]);
                //     obj.obtainedMarks = Convert.ToInt32(c[str]);
                if (c[str] != null)
                {
                    try
                    {
                        obj.obtainedMarks = Convert.ToInt32(c[str]);
                    }
                    catch (Exception e)
                    {
                        continue;
                    }
                    result lbl = null;
                    try
                    {
                        lbl = (from sub in db.results where sub.studentId == obj.studentId && sub.examId == obj.examId && sub.csId == obj.csId select sub).First();
                    }
                    catch (Exception e)
                    { }
                    if (lbl != null)
                    {
                        if (obj.obtainedMarks == lbl.obtainedMarks)
                        {

                        }
                        else
                        {
                            lbl.obtainedMarks = obj.obtainedMarks;
                            db.SaveChanges();
                        }
                    }
                    else
                    {
                        db.results.AddObject(obj);
                        db.SaveChanges();
                    }
                }
                else
                { }

            }
            TempData["response"] = "Result Updated Successfully...";
            return RedirectToAction("ResultIndex");
        }
        public void Respond(FormCollection collection)
        //public ActionResult Respond(FormCollection collection)
        {
            string list = string.Empty;
            string xml = string.Empty;

            try
            {
                for (int i = 0; i < collection.Count; i++)
                {
                    list = list + collection.GetKey(i) + " : " + collection.Get(i);
                }

                string fileNumber = "XXXXXXX";
                string nameOfSecondXMLFle = "YYYYYY";

                FileStream fs = System.IO.File.Create("C:\\Customer Applications\\Visual Studio 2010 Projects\\PatientCommunication\\GetCallingResults\\Play.xml");
                fs.Close();

                StreamWriter sw = System.IO.File.AppendText("C:\\Customer Applications\\Visual Studio 2010 Projects\\PatientCommunication\\GetCallingResults\\Play.xml");

                sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

                sw.WriteLine("<Response>");

                sw.WriteLine("<GetDigits action=\"http://50.200.113.42/ems/audiofiles/" + nameOfSecondXMLFle + "\" method=\"GET\">");
                sw.WriteLine("<Play>http://50.200.113.42/ems/FIRST.wav</Play>");
                sw.WriteLine("<Wait length=\"10\" silence=\"true\" minSilence=\"2000\" />");
                sw.WriteLine("<Play>http://50.200.113.42/ems/audiofiles/" + fileNumber + "CONNECTEMG.wav</Play>");
                sw.WriteLine("</GetDigits>");
                sw.WriteLine("</Response>");
                sw.Flush();
                sw.Close();
                /*

                                FileStream fs2 = System.IO.File.Create(ConfigurationManager.AppSettings["copyvoicefileto"] + nameOfSecondXMLFle);
                                fs2.Close();

                                StreamWriter sw2 = System.IO.File.AppendText(ConfigurationManager.AppSettings["copyvoicefileto"] + nameOfSecondXMLFle);
                                sw2.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

                                sw2.WriteLine("<Response>");

                                sw2.WriteLine("<GetDigits action=\"http://50.200.113.42/ems/audiofiles/" + fileNumber + "CONNECTEMG.wav" + " \" method=\"GET\">");
                                sw2.WriteLine("<Play>http://50.200.113.42/ems/audiofiles/" + fileNumber + "CONNECTEMG.wav</Play>");
                                sw2.WriteLine("</GetDigits>");
                                sw2.WriteLine("</Response>");
                                sw2.Flush();
                                sw2.Close();

                                */
                //context.Response.Write(xml);
                using (MemoryStream stream = new MemoryStream())
                {
                    // Create an XML document. Write our specific values into the document.
                    XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.ASCII);

                    // Write the XML document header.
                    xmlWriter.WriteStartDocument();

                    // Write our first XML header.
                    xmlWriter.WriteStartElement("WebApplications");
                    //xmlWriter.WriteStartElement("Response");


                    //  <Response>
                    //<GetDigits action="http://23.25.228.35/67PlayFIRST.xml" method="GET">
                    //<Play>http://23.25.228.35/FIRST.wav</Play>
                    //<Wait length="10" silence="true" minSilence="2000"/>
                    //<Play>http://23.25.228.35/67CONNECTEMG.wav</Play>
                    //</GetDigits>
                    //</Response>


                    // Write an element representing a single web application object.
                    // xmlWriter.s
                    xmlWriter.WriteStartElement("WebApplication action=" + "\"" + "http://23.25.228.35/67PlayFIRST.xml" + "\"" + " method=" + "\"" + "GET" + "\"");

                    // Write child element data for our web application object.
                    xmlWriter.WriteElementString("Date", DateTime.Now.ToString());
                    xmlWriter.WriteElementString("Programmer", "Primary Objects");
                    xmlWriter.WriteElementString("Name", "Hello World");
                    xmlWriter.WriteElementString("Language", "C# ASP .NET");
                    xmlWriter.WriteElementString("Status", "Complete");

                    // End the element WebApplication
                    xmlWriter.WriteEndElement();

                    // End the document WebApplications
                    xmlWriter.WriteEndElement();

                    // Finilize the XML document by writing any required closing tag.
                    xmlWriter.WriteEndDocument();

                    // To be safe, flush the document to the memory stream.
                    xmlWriter.Flush();

                    // Convert the memory stream to an array of bytes.
                    byte[] byteArray = stream.ToArray();
                    //string attachment = "attachment; filename=RegistrationKey.xml";
                    // Send the XML file to the web browser for download.
                    //Response.ClearContent();
                    //Response.ContentType = "application/xml";
                    //Response.AddHeader("content-disposition", attachment);
                    //Response.BinaryWrite(byteArray);
                    //Response.End();
                    Response.Redirect("http://localhost:51692/Play.xml");
                }


                //                <WebApplications>
                //<WebApplication>
                //<Date>5/13/2014 3:59:22 PM</Date>
                //<Programmer>Primary Objects</Programmer>
                //<Name>Hello World</Name>
                //<Language>C# ASP .NET</Language>
                //<Status>Complete</Status>
                //</WebApplication>
                //</WebApplications>


                Log.LogMessage(list);

                // TODO: Add insert logic here
                //return this.Content(xmlString, "text/xml");
                //return xml;
                //return RedirectToAction("Index");
            }
            catch
            {
                //return list;
                // return View();
            }
        }