public object Clone()
        {
            var newComanda = (Comenzi)MemberwiseClone();

            newComanda.Articole = new List <string>(Articole);
            for (var i = 0; i < Articole.Count(); i++)
            {
                newComanda.Articole[i] = Articole[i];
            }
            return(newComanda);
        }
Ejemplo n.º 2
0
        private static void SendMessage(ConnectionFactory factory, Articole model)
        {
            using (var connection = factory.CreateConnection())
                using (var channel = connection.CreateModel())
                {
                    channel.QueueDeclare(queue: "test", durable: false, exclusive: false, autoDelete: false, arguments: null);


                    var json = JsonConvert.SerializeObject(model);
                    var body = Encoding.UTF8.GetBytes(json);

                    channel.BasicPublish(exchange: "", routingKey: "test", basicProperties: null, body: body);
                }
        }
Ejemplo n.º 3
0
    protected void Cauta_Dupa_Autor(object sender, EventArgs e)
    {
        //string query = Server.UrlDecode(Request.Params["id"]);
        string autor = Text_Dupa_Autor.Text;

        Mesaj.Text             = "";
        Articole.SelectCommand = "SELECT b.Id, Titlu, Descriere, Username, Data_publicare, Cale FROM [Imagine] c,[Articol] b , [User] a WHERE b.id_user = a.Id AND b.Id = c.Id_Articol AND a.Username = @user";

        Articole.SelectParameters.Clear();
        Articole.SelectParameters.Add("user", autor);
        Articole.DataBind();
        Text_Dupa_Autor.Text = "";

        //string dataCautare = Text_Data.Text;
    }
Ejemplo n.º 4
0
    protected void Cauta_Dupa_User(object sender, EventArgs e)
    {
        //string query = Server.UrlDecode(Request.Params["id"]);
        string autor = Text_Stiri_Dupa_User.Text;

        Mesaj.Text             = "";
        Articole.SelectCommand = "select a.Id, Titlu_propunere, Continut_propunere, Username, Data_propunere, c.Nume,Imagine_propunere from [Stiri_Propuse] a, [User] b,[Categorii] c where b.Id=a.User_propunere and a.Categorie_propunere=c.Id and b.Username = @user";

        Articole.SelectParameters.Clear();
        Articole.SelectParameters.Add("user", autor);
        Articole.DataBind();
        Text_Stiri_Dupa_User.Text = "";
        pnl.Visible = false;

        //string dataCautare = Text_Data.Text;
    }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && Request.Params["q"] != null)
        {
            string query = Server.UrlDecode(Request.Params["q"]);

            if (query.Length > 0)
            {
                Criteriu.Text = "Rezultatele cautarii: " + query;
            }


            Articole.SelectCommand = "SELECT distinct [Articol].[Id],[Articol].[Titlu], [Articol].[Descriere],[Articol].[Data_Publicare],[Imagine].[Cale],  [User].[Username]"
                                     + " FROM [Articol],[User] ,[Imagine],[Categorii] "
                                     + " WHERE [Articol].[Id]=[Imagine].[Id_Articol] AND [Articol].[Id_User] = [User].[Id] AND [Articol].[Categorie] = [Categorii].[Id]"
                                     + " AND ([Articol].[Titlu] like @q OR [Articol].[Descriere] like @q OR [Categorii].[Nume] like @q) order by [Articol].[Titlu]";

            Articole.SelectParameters.Clear();
            Articole.SelectParameters.Add("q", "%" + query + "%");
            Articole.DataBind();
        }
    }
Ejemplo n.º 6
0
    protected void Cauta_Dupa_Data(object sender, EventArgs e)
    {
        //string query = Server.UrlDecode(Request.Params["id"]);
        DateTime dataCautare;

        if (DateTime.TryParse(Text_Data.Text, out dataCautare))
        {
            Mesaj.Text             = "";
            Articole.SelectCommand = "select b.Id, Titlu, Descriere, Username, Data_publicare, Cale from [Imagine] c,[Articol] b , [User] a where b.id_user = a.Id and b.Id = c.Id_Articol and convert(datetime, convert(varchar(10), Data_Publicare, 102))  = convert(datetime, @data)";

            Articole.SelectParameters.Clear();
            Articole.SelectParameters.Add("data", dataCautare.ToString());
            Articole.DataBind();
            Text_Data.Text = "";
        }
        else
        {
            Mesaj.Text = "Introdu o data valida!";
        }

        //string dataCautare = Text_Data.Text;
    }
Ejemplo n.º 7
0
        public ActionResult Create(Articole articol)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ViewBag.Text = ci.InsertSqlRowsArticole(articol);
                }

                var factory = new ConnectionFactory()
                {
                    Uri      = new Uri("amqp://*****:*****@shark.rmq.cloudamqp.com/eoqhublt"),
                    UserName = "******",
                    Password = "******",
                };
                SendMessage(factory, articol);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }