Beispiel #1
0
        //autenticacao da plataforma
        public ActionResult LoginForm(FormCollection loginForm)
        {
            //acessar passar os dados vindos da view autenticacao
            var dados = "";

            dados += "&username="******"Email"].ToString();
            dados += "&password="******"Senha"].ToString();
            IRestResponse respondelogin = helper.Login(urlacessoplataforma, dados);

            if (respondelogin.StatusCode.ToString() == "OK")
            {
                //criacao da sessao
                Session["EstaLogado"]   = loginForm.ToString();
                Session["TokenUsuario"] = loginForm.ToString();

                string          json      = respondelogin.Content.ToString();
                UsuarioLoginDTO item      = Newtonsoft.Json.JsonConvert.DeserializeObject <UsuarioLoginDTO>(json);
                int             IDUsuario = item.IDUsuario;
                string          email     = item.Email;
                string          nome      = item.Nome;
                string          token     = item.access_token;
                UsuarioLoginDTO Token     = new UsuarioLoginDTO();
                {
                    Token.access_token = token;
                };
                Session["IDUsuario"] = item.IDUsuario.ToString();
                Session["Nome"]      = item.Nome.ToString();
                // Session["Email"] = item.Email.ToString();
                Session["TokenUsuario"] = item.access_token.ToString();
                return(RedirectToAction("Index", "Home"));
            }
            TempData["SuccessErrorS"] = "Ocorreu um problema ao processar sua autenticação!";
            return(View("index"));
        }
Beispiel #2
0
        public void RQueue(FormCollection collenction)
        {
            var factory = new ConnectionFactory()
            {
                HostName = "localhost"
            };

            using (var connection = factory.CreateConnection())
                using (var channel = connection.CreateModel())
                {
                    channel.QueueDeclare(queue: "task_queue",
                                         durable: true,
                                         exclusive: false,
                                         autoDelete: false,
                                         arguments: null);

                    var message = collenction.ToString();
                    var body    = Encoding.UTF8.GetBytes(message);

                    var properties = channel.CreateBasicProperties();
                    properties.Persistent = true;

                    channel.BasicPublish(exchange: "",
                                         routingKey: "task_queue",
                                         basicProperties: properties,
                                         body: body);
                    Console.WriteLine(" [x] Sent {0}", message);
                }
        }
Beispiel #3
0
 public ActionResult Create(FormCollection collection)
 {
     System.Diagnostics.Debug.WriteLine(collection.ToString());
     try
     {
         // TODO: Add insert logic here
         Course course = new Course {
             Name       = collection["Name"],
             Designator = collection["Designator"],
         };
         db.Courses.Add(course);
         //Add units 1 - 5 for the new course
         for (int weekNumber = 1; weekNumber <= 5; weekNumber++)
         {
             Unit unit = new Unit {
                 WeekNumber = weekNumber,
                 CourseId   = course.Id
             };
             db.Units.Add(unit);
         }
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #4
0
 public bool Opprettprodukt(FormCollection innProdukt)
 {
     if (innProdukt.ToString() == null)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Beispiel #5
0
 public ActionResult Delete(int?id, FormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         string str = collection.ToString();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #6
0
        public string onSearch(FormCollection context)
        {
            try
            {
                var json = context.ToString();
                var rpm  = GetRpm(context);

                return(JSONhelper.ToJson(new { errCode = 0, errMsg = "" }));
            }
            catch (Exception ex)
            {
                return(JSONhelper.ToJson(new { errCode = -1, errMsg = ex.Message }));
            }
        }
Beispiel #7
0
        public ActionResult UpdateTour(FormCollection fc)
        {
            if (fc["Post_id"].Trim() != null && fc["Post_id"].Trim() != "0")
            {
                Models.Tour TourOld = new Tour().GetByTourID(Convert.ToInt32(fc["Post_id"].Trim()));
                TourOld.Tour_Name               = fc["Post_Tile"].Trim();
                TourOld.Tour_Content            = fc["editor"].Trim();
                TourOld.Tour_OrganizationalUnit = fc["Tour_OrganizationalUnit"].Trim();
                string Description = "";
                if (Funtions.StripHTML(fc["editor"].Trim()).Length > 200)
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                else
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                TourOld.Tour_Description   = Description;
                TourOld.Tour_Topic         = fc.ToString("tour_Topic");
                TourOld.Tour_Location      = fc.ToInt("Tour_Location");
                TourOld.Tour_Price         = fc.ToInt("Tour_Price");
                TourOld.Tour_DepartureDate = Funtions.ddMMyyyy(fc["Tour_DepartureDate"].Trim());
                TourOld.Tour_TimeZone      = Convert.ToInt32(fc["Tour_TimeZone"].Trim());
                TourOld.Tour_Itinerary     = fc["editor_Tour_Itinerary"].Trim();
                TourOld.Tour_Schedule      = fc["editor_Tour_Schedule"].Trim();
                TourOld.Tour_Rules         = fc["editor_Tour_Rules"].Trim();
                TourOld.Tour_ListImage     = fc["List_Images_Combo"].Trim();
                TourOld.Tour_Image         = fc["_thumbnail_id"].Trim();
                TourOld.Product_ID         = 1;
                TourOld.UserCreate         = Convert.ToInt32(Session["User_ID"]);
                TourOld.Tour_StarRate      = fc.ToDouble("Star_Rating");
                TourOld.Tour_Qty           = fc.ToInt("Tour_Qty");
                TourOld.Tour_Score         = fc.ToFloat("Tour_Score");
                TourOld.Tour_Price         = fc.ToInt("Tour_Price");
                TourOld.Tour_PriceSale     = fc.ToInt("Tour_PriceSale");
                TourOld.Hotel_ID           = fc.ToInt("Hotel_ID");
                TourOld.Update();

                TempData["MessagePost"] = "Cập nhật Combo thành công";
                return(RedirectToAction("EditTour", "Manager", new { id = TourOld.Tour_ID }));
            }
            else
            {
                Models.Tour TourOld = new Tour();
                TourOld.Tour_Name               = fc["Post_Tile"].Trim();
                TourOld.Tour_Content            = fc["editor"].Trim();
                TourOld.Tour_OrganizationalUnit = fc["Tour_OrganizationalUnit"].Trim();
                string Description = "";
                if (Funtions.StripHTML(fc["editor"].Trim()).Length > 200)
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                else
                {
                    Description = Funtions.StripHTML(fc["editor"].Trim());
                }
                TourOld.Tour_Description = Description;
                TourOld.Tour_Topic       = fc.ToString("tour_Topic");
                TourOld.Tour_Location    = fc.ToInt("Tour_Location");
                TourOld.Hotel_ID         = fc.ToInt("Hotel_ID");

                TourOld.Tour_DepartureDate = Funtions.ddMMyyyy(fc["Tour_DepartureDate"].Trim());
                TourOld.Tour_TimeZone      = fc.ToInt("Tour_TimeZone");
                TourOld.Tour_Itinerary     = fc["editor_Tour_Itinerary"].Trim();
                TourOld.Tour_Schedule      = fc["editor_Tour_Schedule"].Trim();
                TourOld.Tour_Rules         = fc["editor_Tour_Rules"].Trim();
                TourOld.Tour_ListImage     = fc["List_Images_Combo"].Trim();
                TourOld.Tour_Image         = fc["_thumbnail_id"].Trim();
                TourOld.Product_ID         = 1;
                TourOld.UserCreate         = Convert.ToInt32(Session["User_ID"]);
                TourOld.CreateDate         = DateTime.Now;
                TourOld.Tour_StarRate      = fc.ToDouble("Star_Rating");
                TourOld.Tour_Qty           = fc.ToInt("Tour_Qty");
                TourOld.Tour_Score         = fc.ToFloat("Tour_Score");
                TourOld.Tour_Price         = fc.ToInt("Tour_Price");
                TourOld.Tour_PriceSale     = fc.ToInt("Tour_PriceSale");
                int TourID = TourOld.Insert();

                TempData["MessagePost"] = "Thêm mới Combo thành công";
                return(RedirectToAction("EditTour", "Manager", new { id = TourID }));
            }
        }