Example #1
0
        protected override async System.Threading.Tasks.Task OnInitializedAsync()
        {
            soferi       = new List <Models.FirmaCurierat.Soferi>();
            client       = new Models.FirmaCurierat.Clienti();
            comanda      = new Models.FirmaCurierat.Comenzi();
            tip          = new List <Models.FirmaCurierat.TipComenzi>();
            coordsList   = new List <Models.FirmaCurierat.Dispeceri>();
            tip_selected = new Models.FirmaCurierat.TipComenzi();
            // SqlConnection scn = new SqlConnection();
            string ServerName = Environment.MachineName;

            string database         = "CurieratVladProiect";
            string ConnectionString = String.Format(@"Server={0}\SQLEXPRESS;Initial Catalog={1};
                                               Integrated Security = SSPI", ServerName, database);

            //lista de dispeceri pentur a putea atribuii comenzii
            coordsList = new List <Models.FirmaCurierat.Dispeceri>();
            string sqlCommand = "select * from  dispeceri";

            dataHelper = new DataBaseManagement.DataManagement();
            coordsList = await dataHelper.LoadData <Models.FirmaCurierat.Dispeceri, dynamic>(sqlCommand, new { }, ConnectionString);

            //ce tipuri de comenzi am
            sqlCommand = "select * from tip_comenzi";
            tip        = await dataHelper.LoadData <Models.FirmaCurierat.TipComenzi, dynamic>(sqlCommand, new { }, ConnectionString);

            //soferii
            sqlCommand = "select * from soferi";
            soferi     = await dataHelper.LoadData <Models.FirmaCurierat.Soferi, dynamic>(sqlCommand, new { }, ConnectionString);
        }
Example #2
0
        protected async Task loadLists()
        {
            dataHelper = new DataBaseManagement.DataManagement();
            SqlConnection scn        = new SqlConnection();
            string        ServerName = Environment.MachineName;

            string database         = "CurieratVladProiect";
            string ConnectionString = String.Format(@"Server={0}\SQLEXPRESS;Initial Catalog={1};
                                               Integrated Security = SSPI", ServerName, database);

            scn.ConnectionString = ConnectionString;
            coordsList           = new List <Models.FirmaCurierat.Dispeceri>();
            string sqlCommand = "select * from  dispeceri";

            SqlCommand scmd = new SqlCommand("select * from  dispeceri", scn);

            scmd.Parameters.Clear();
            scn.Open();
            var dr = scmd.ExecuteReader();

            while (dr.Read())
            {
                Models.FirmaCurierat.Dispeceri temp = new Models.FirmaCurierat.Dispeceri();
                temp.id_dispecer   = (int)dr["id_dispecer"];
                temp.nume_dispecer = (string)dr["nume_dispecer"];
                coordsList.Add(temp);
            }
            sqlCommand = "select * from tip_comenzi";
            tip        = new List <Models.FirmaCurierat.TipComenzi>();
            scmd       = new SqlCommand("select * from tip_comenzi", scn);
            dr.Close();
            scmd.Parameters.Clear();
            dr = scmd.ExecuteReader();

            while (dr.Read())
            {
                Models.FirmaCurierat.TipComenzi temp = new Models.FirmaCurierat.TipComenzi();
                temp.id_tip       = (int)dr["id_tip"];
                temp.specificatii = (string)dr["specificatii"];
                temp.tip          = (string)dr["tip"];
            }
        }
Example #3
0
        protected async Task loadClientsandOrders()
        {
            //initializare liste
            tip          = new List <Models.FirmaCurierat.TipComenzi>();
            tip_selected = new Models.FirmaCurierat.TipComenzi();
            comenzi      = new List <Models.FirmaCurierat.Comenzi>();
            dataHelper   = new DataBaseManagement.DataManagement();
            clients      = new List <Models.FirmaCurierat.Clienti>();
            client       = new Models.FirmaCurierat.Clienti();
            SqlConnection scn        = new SqlConnection();
            string        ServerName = Environment.MachineName;

            string database         = "CurieratVladProiect";
            string ConnectionString = String.Format(@"Server={0}\SQLEXPRESS;Initial Catalog={1};
                                               Integrated Security = SSPI", ServerName, database);

            scn.ConnectionString = ConnectionString;
            scn.Open();
            // string ConnectionString = @"Data Source=DESKTOP-I3NIEPL\SQLEXPRESS;Initial Catalog=login_database;database=CurieratVladProiect;integrated security=SSPI";

            comanda = new Models.FirmaCurierat.Comenzi();
            //selecteaza comenzile clientului cu id-ul cliend_id
            SqlCommand scmd = new SqlCommand("select * from  comenzi where id_client = @id", scn);

            scmd.Parameters.Clear();

            scmd.Parameters.AddWithValue("@id", client_id);

            using (SqlDataReader reader = scmd.ExecuteReader())
            {
                //ia informatiile despre comanda
                if (reader.Read())
                {
                    comanda.awb          = (string)reader["awb"];
                    comanda.data_livrare = (string)reader["data_livrare"];
                    comanda.id_client    = (int)reader["id_client"];
                    comanda.id_comanda   = (int)reader["id_comanda"];
                    comanda.id_dispecer  = (int)reader["id_dispecer"];
                }
            }
            //selectam id-ul tipului comenzii
            scmd = new SqlCommand("select id_tip from tipul_comenzii where id_comanda = @id;;SELECT SCOPE_IDENTITY()", scn);
            scmd.Parameters.AddWithValue("@id", comanda.id_comanda);
            int tip_id = Convert.ToInt32(scmd.ExecuteScalar());

            //selectam tipul comenzii
            scmd = new SqlCommand("select * from tip_comenzi where id_tip = @id", scn);
            scmd.Parameters.Clear();
            scmd.Parameters.AddWithValue("@id", tip_id);

            using (SqlDataReader reader = scmd.ExecuteReader())
            {
                //luam datele despre tip si specificatiile
                if (reader.Read())
                {
                    tip_selected.id_tip       = (int)reader["id_tip"];
                    tip_selected.specificatii = (string)reader["specificatii"];
                    tip_selected.tip          = (string)reader["tip"];
                }
            }
            string sqlCommand = "select * from tip_comenzi";

            tip = await dataHelper.LoadData <Models.FirmaCurierat.TipComenzi, dynamic>(sqlCommand, new { }, ConnectionString);
        }