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)); }
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)); }