コード例 #1
0
        public string registerSale(string idClient, string phonesQuantities, string total, string key)
        {
            EncryptionMethods em     = new EncryptionMethods();
            string            conn   = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            ClientBusiness    cb     = new ClientBusiness(conn);
            SaleBusiness      sb     = new SaleBusiness(conn);
            PhoneSaleBusiness psb    = new PhoneSaleBusiness(conn);
            PhoneBusiness     pb     = new PhoneBusiness(conn);
            Client            client = cb.getClientById(Int32.Parse(em.decrypting(idClient, key)));
            Sale sale = new Sale(0, client, Int32.Parse(em.decrypting(total, key)), DateTime.Today.ToString());
            int  r    = sb.insertSale(sale);

            sale.IdSale = r;
            string phonesQ = em.decrypting(phonesQuantities, key);

            string[] phones = phonesQ.Split('#');
            for (int i = 0; i < phones.Length; i++)
            {
                string[]  data  = phones[i].Split(';');
                Phone     phone = pb.getPhoneById(Int32.Parse(data[0]));
                PhoneSale ps    = new PhoneSale(0, phone, sale, Int32.Parse(data[1]));
                psb.insertPhoneSale(ps);
            }
            string response = "1";

            return(em.encrypt(response, key));
        }
コード例 #2
0
        public string getBrandById(string idBrand, string key)
        {
            EncryptionMethods em   = new EncryptionMethods();
            string            conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            BrandBusiness     b    = new BrandBusiness(conn);
            int    t        = Int32.Parse(em.decrypting(idBrand + "", key));
            Brand  brand    = b.getBrandById(t);
            string response = brand.IdBrand + ";" + brand.Name;

            return(em.encrypt(response, key));
        }
コード例 #3
0
        public string deleteBrand(string idBrand, string key)
        {
            string            conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            BrandBusiness     b    = new BrandBusiness(conn);
            EncryptionMethods em   = new EncryptionMethods();
            int    t        = Int32.Parse(em.decrypting(idBrand + "", key));
            int    r        = b.deleteBrand(t);
            string response = em.encrypt(r + "", key);

            return(response);
        }
コード例 #4
0
        public string getClient(string nameUser, string key)
        {
            string            conn     = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            ClientBusiness    cb       = new ClientBusiness(conn);
            EncryptionMethods em       = new EncryptionMethods();
            Client            client   = cb.getClientByUserName(em.decrypting(nameUser, key));
            string            response = client.IdUser + ";" + client.Name + ";" + client.LastName_1 + ";" + client.LastName_2 + ";" + client.PasswordUser + ";" + client.Email + ";" + client.NumberCard + ";" +
                                         client.AddressDirection + ";" + client.PostalCode + ";" + client.SvcCard;

            return(em.encrypt(response, key));
        }
コード例 #5
0
        public string deleteClient(string idClient, string key)
        {
            EncryptionMethods em   = new EncryptionMethods();
            string            conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            ClientBusiness    cb   = new ClientBusiness(conn);
            int    t        = Int32.Parse(em.decrypting(idClient + "", key));
            int    r        = cb.deleteClient(t);
            string response = em.encrypt(r + "", key);

            return(response);
        }
コード例 #6
0
        public string verifyExistsClient(string client, string key)
        {
            string            conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            ClientBusiness    cb   = new ClientBusiness(conn);
            EncryptionMethods em   = new EncryptionMethods();
            string            text = em.decrypting(client, key);

            string[] fields   = text.Split(';');
            int      r        = cb.verifyExistsClient(fields[0], fields[1]);
            string   response = em.encrypt(r + "", key);

            return(response);
        }
コード例 #7
0
        public string updateClient(string client, string key)
        {
            string            conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            ClientBusiness    cb   = new ClientBusiness(conn);
            EncryptionMethods em   = new EncryptionMethods();
            string            text = em.decrypting(client, key);

            string[] fields   = text.Split(';');
            Client   clientO  = new Client(Int32.Parse(fields[0]), fields[1], fields[2], fields[3], fields[4], fields[5], fields[6], fields[7], fields[8], fields[9], fields[10]);
            int      r        = cb.updateClient(clientO);
            string   response = em.encrypt(r + "", key);

            return(response);
        }
コード例 #8
0
        public string getPhoneById(string idPhone, string key)
        {
            EncryptionMethods em   = new EncryptionMethods();
            string            conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            int           t        = Int32.Parse(em.decrypting(idPhone, key));
            PhoneBusiness pb       = new PhoneBusiness(conn);
            BrandBusiness bb       = new BrandBusiness(conn);
            Phone         phone    = pb.getPhoneById(t);
            Brand         brand    = bb.getBrandById(phone.Brand.IdBrand);
            string        path     = phone.Image;
            string        response = phone.IdPhone + ";" + phone.Model + ";" + brand.Name + ";" + phone.OS + ";" + phone.NetworkMode + ";" + phone.InternalMemory + ";" + phone.ExternalMemory + ";" +
                                     phone.Pixels + ";" + phone.Flash + ";" + phone.Resolution + ";" + phone.Price + ";" + phone.Quantity + ";" + "http://25.45.62.52/CoreVises" + path.Substring(2, path.Length - 2);

            return(em.encrypt(response, key));
        }
コード例 #9
0
        public string getAllBrands(string key)
        {
            string            response          = "";
            string            conn              = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            BrandBusiness     b                 = new BrandBusiness(conn);
            EncryptionMethods em                = new EncryptionMethods();
            DataSet           dsBrand           = b.getAllBrands();
            DataRowCollection dataRowCollection = dsBrand.Tables["TBrand"].Rows;

            foreach (DataRow currentRow in dataRowCollection)
            {
                response += currentRow["idBrand"].ToString() + ";" + currentRow["name"].ToString() + "#";
            }

            return(em.encrypt(response, key));
        }
コード例 #10
0
        public string getPhones(string key)
        {
            string            response          = "";
            string            conn              = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            PhoneBusiness     pb                = new PhoneBusiness(conn);
            EncryptionMethods em                = new EncryptionMethods();
            DataSet           dsPhone           = pb.getPhones();
            DataRowCollection dataRowCollection = dsPhone.Tables["TPhone"].Rows;
            BrandBusiness     bb                = new BrandBusiness(conn);
            string            path              = "";

            foreach (DataRow currentRow in dataRowCollection)
            {
                Brand brand = bb.getBrandById(Int32.Parse(currentRow["idBrand"].ToString()));
                path      = currentRow["imagePhone"].ToString();
                response += currentRow["idPhone"].ToString() + ";" + currentRow["model"].ToString() + ";" + brand.Name + ";" + currentRow["OS"].ToString()
                            + ";" + currentRow["networkMode"].ToString() + ";" + currentRow["internalMemory"].ToString() + ";" + currentRow["externalMemory"].ToString() + ";" + currentRow["pixels"].ToString() + ";" +
                            currentRow["flash"].ToString() + ";" + currentRow["resolution"].ToString() + ";" + currentRow["price"].ToString() + ";" + currentRow["quantity"].ToString() + ";" + "http://25.45.62.52/CoreVises" + path.Substring(2, path.Length - 2) + "#";
            }

            return(em.encrypt(response, key));
        }
コード例 #11
0
ファイル: UnitTest1.cs プロジェクト: JosephCM2110/CoreVises
        public void TestMethod1()
        {
            //PhoneData data = new PhoneData("Data Source = 163.178.107.130; Initial Catalog = KeggPhones; User Id = sqlserver; Password = saucr.12");
            //DataSet dsPhones = data.getPhonesLike("8");

            //DataRowCollection dataRowCollection = dsPhones.Tables["TPhone"].Rows;

            //foreach (DataRow currentRow in dataRowCollection)
            //{
            //    Console.WriteLine(currentRow["model"]);

            //}
            //Reports.ReportsMethods r = new Reports.ReportsMethods();

            //r.generatePhoneSaleReport();

            //SaleData pd = new SaleData("Data Source = 163.178.107.130; Initial Catalog = KeggPhones; User Id = sqlserver; Password = saucr.12");


            //Object[] a = pd.getBestClients();

            //List<Client> c = (List<Client>) a[0];
            //List<int> i = (List<int>)a[1];

            //int x = 0;

            //SaleServiceReference.SaleServiceClient c = new SaleServiceReference.SaleServiceClient();

            //c.registerSale(11, "18.1,19.2", 10000);



            //PhoneData cd = new PhoneData("Data Source = 163.178.107.130; Initial Catalog = KeggPhones; User Id = sqlserver; Password = saucr.12");
            //Phone c = cd.getPhoneById(18);
            //Console.WriteLine(c.Model);
            //Console.ReadLine();

            string texto = "20000";

            Console.WriteLine(texto);
            Console.WriteLine("------------------------------------------------------------------");
            string            key    = "YARR";
            EncryptionMethods e      = new EncryptionMethods();
            string            textoe = e.encrypt(texto, key);

            Console.WriteLine(textoe);
            Console.WriteLine("------------------------------------------------------------------");
            string textodes = e.decrypting(textoe, key);

            Console.WriteLine(textodes);
            //string ruta = "../Images/imagen.png";
            //Console.WriteLine(ruta.Length+"");
            //Console.WriteLine(ruta.Substring(2, ruta.Length-2));



            //PhoneServiceReference.PhoneServiceClient c = new PhoneServiceReference.PhoneServiceClient();

            //int r = c.getPhones().Count();

            //Console.WriteLine(r);

            //Console.ReadLine();
        }