コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataSet ds = AddressDB.selectAllEstados();
            ddl_estadoDestino.DataSource = ds;
            ddl_estadoOrigem.DataSource  = ds;

            ddl_estadoDestino.DataTextField  = "uc_uf";
            ddl_estadoDestino.DataValueField = "uc_uf";
            ddl_estadoDestino.DataBind();



            ddl_estadoOrigem.DataTextField  = "uc_uf";
            ddl_estadoOrigem.DataValueField = "uc_uf";
            ddl_estadoOrigem.DataBind();

            string estado = ddl_estadoDestino.SelectedValue;
            ds = AddressDB.selectAllCidades(estado);
            ddl_cidadeDestino.DataSource     = ds;
            ddl_cidadeDestino.DataTextField  = "uc_cidade";
            ddl_cidadeDestino.DataValueField = "uc_cidade";
            ddl_cidadeDestino.DataBind();

            estado = ddl_estadoOrigem.SelectedValue;
            ds     = AddressDB.selectAllCidades(estado);
            ddl_cidadeOrigem.DataSource     = ds;
            ddl_cidadeOrigem.DataTextField  = "uc_cidade";
            ddl_cidadeOrigem.DataValueField = "uc_cidade";
            ddl_cidadeOrigem.DataBind();
        }
    }
コード例 #2
0
 public static void UpdateAddress(Address addressObject)
 {
     using (AddressDB db = new AddressDB())
     {
         db.Address.Update(addressObject);
         db.SaveChanges();
     }
 }
コード例 #3
0
 public static void RemoveAddress(int id)
 {
     using (AddressDB db = new AddressDB())
     {
         if (db.Address.Where(t => t.Id == id).Count() > 0) // Check if element exists
             db.Address.Remove(db.Address.First(t => t.Id == id));
         db.SaveChanges();
     }
 }
コード例 #4
0
        public void btn_submit_Clicked()
        {
            // NEED TO DO VERIFICATION ON FORM. TRY CATCH ON REQUIRED EMPTY VARIABLES?

            if (string.IsNullOrEmpty(view.getMiddleName()))
            {
                personBuilder
                .WithNoMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getLastName());

                if (string.IsNullOrEmpty(view.getEmergency()))
                {
                    personBuilder
                    .WithPrimaryContactOnly(view.getPhone());

                    if (string.IsNullOrEmpty(view.getSecondLine()) && string.IsNullOrEmpty(view.getThirdLine()))
                    {
                        addressBuilder
                        .OneLineAddress(view.getFirstLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                    else if (string.IsNullOrEmpty(view.getThirdLine()))
                    {
                        addressBuilder
                        .TwoLineAddress(view.getFirstLine(), view.getSecondLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                    else
                    {
                        addressBuilder
                        .ThreeLineAddress(view.getFirstLine(), view.getSecondLine(), view.getThirdLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                }
                else
                {
                    personBuilder
                    .WithAllContacts(view.getPhone(), view.getEmergency());
                }
            }
            else
            {
                personBuilder
                .WithMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getMiddleName(), view.getLastName());
            }

            gp      = personBuilder.Build();
            address = addressBuilder.Build();
            GP practice = new GP();

            practice.GPPractice = view.getPracticeName();
            MemberDB.InsertGP(gp);
            AddressDB.InsertAddress(address);
            GPDB.InsertGP(practice);

            ConfirmationForm      cForm      = new ConfirmationForm();
            ConfirmationPresenter cPresenter = new ConfirmationPresenter(cForm);

            cForm.Show();
        }
コード例 #5
0
 public static string GetAddress(int id)
 {
     using (AddressDB db = new AddressDB())
     {
         if (db.Address.Where(t => t.Id == id).Count() > 0)
             return JsonConvert.SerializeObject(db.Address.First(t => t.Id == id));
         else
             return "{}";
     }
 }
コード例 #6
0
        static void Main(string[] args)
        {
            AddressDB  address  = new AddressDB();
            CustomerDB customer = new CustomerDB();
            InvoiceDB  invoice  = new InvoiceDB();

            PrintInfo(address);
            PrintInfo(customer);
            PrintInfo(invoice);
        }
コード例 #7
0
    protected void ddl_estadoOrigem_SelectedIndexChanged(object sender, EventArgs e)
    {
        string  estado = ddl_estadoOrigem.SelectedValue;
        DataSet ds     = AddressDB.selectAllCidades(estado);

        ddl_cidadeOrigem.DataSource     = ds;
        ddl_cidadeOrigem.DataTextField  = "uc_cidade";
        ddl_cidadeOrigem.DataValueField = "uc_cidade";
        ddl_cidadeOrigem.DataBind();
    }
コード例 #8
0
        public AddressDTO GetAddress(AddressDTO addressDTO)
        {
            AddressDB addressDB = new AddressDB();

            AddressDTO address = new AddressDTO();

            addressDB = cartDBOperations.GetBillingAddress(addressDTO);

            address.Address = addressDB.DeliveryAddress;
            address.Email   = addressDB.Email;

            return(address);
        }
コード例 #9
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            AddressDB = await _context.Address.FirstOrDefaultAsync(m => m.Id == id);

            if (AddressDB == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #10
0
        public AddressDB GetBillingAddress(AddressDTO addressDTO)
        {
            var addressDB = new AddressDB();

            using (var context = new ECommerceDB())
            {
                if (context.addressDB.Any(x => x.Email == addressDTO.Email))
                {
                    return(context.addressDB.FirstOrDefault(x => x.Email == addressDTO.Email));
                }
                else
                {
                    return(null);
                }
            }
        }
コード例 #11
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            AddressDB = await _context.Address.FindAsync(id);

            if (AddressDB != null)
            {
                _context.Address.Remove(AddressDB);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #12
0
 public static int Save(Address address)
 {
     return(AddressDB.Save(address));
 }
コード例 #13
0
 //to get the table from the address table
 public static object GetAddress()
 {
     return(AddressDB.GetAddress());
 }
コード例 #14
0
        public void btn_submit_Clicked()
        {
            personBuilder
            .setMember((Member)Enum.Parse(typeof(Member), view.getMember()))
            .setGender((Gender)Enum.Parse(typeof(Gender), view.getGender()))
            .setDOB(view.getDOB());


            if (string.IsNullOrEmpty(view.getMiddleName()))
            {
                personBuilder
                .WithNoMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getLastName());

                if (string.IsNullOrEmpty(view.getEmergency()))
                {
                    personBuilder
                    .WithPrimaryContactOnly(view.getPhone());

                    if (string.IsNullOrEmpty(view.getSecondLine()) && string.IsNullOrEmpty(view.getThirdLine()))
                    {
                        addressBuilder
                        .OneLineAddress(view.getFirstLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                    else if (string.IsNullOrEmpty(view.getThirdLine()))
                    {
                        addressBuilder
                        .TwoLineAddress(view.getFirstLine(), view.getSecondLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                    else
                    {
                        addressBuilder
                        .ThreeLineAddress(view.getFirstLine(), view.getSecondLine(), view.getThirdLine(), view.getCity(), view.getCounty(), view.getPostcode());
                    }
                }
                else
                {
                    personBuilder
                    .WithAllContacts(view.getPhone(), view.getEmergency());
                }
            }
            else
            {
                personBuilder
                .WithMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getMiddleName(), view.getLastName());
            }

            member = personBuilder.Build();
            MemberDB.InsertMember(member);
            address = addressBuilder.Build();
            AddressDB.InsertAddress(address);

            if (view.getMember() == "Patient")
            {
                GPInformationForm      gpForm      = new GPInformationForm();
                GPInformationPresenter gpPresenter = new GPInformationPresenter(gpForm);
                gpForm.Show();
            }
            else
            {
                ConfirmationForm      cForm      = new ConfirmationForm();
                ConfirmationPresenter cPresenter = new ConfirmationPresenter(cForm);
                cForm.Show();
            }
        }
コード例 #15
0
    protected void btnAvancar1_Click(object sender, EventArgs e)
    {
        Caravan car = (Caravan)Session["cadastro"];

        endereco[] enderecos = (endereco[])Session["auxiliar"];
        car.Usu_car_criador = Convert.ToInt32(Session["id"]);
        if (CaravanDB.insertCaravan(car) == 0)
        {
            int      id        = CaravanDB.selectCaravan(car);
            int      id2       = 0;
            string[] categoria = car.Car_categoria.Split(';');
            for (int i = 0; i < categoria.Length; i++)
            {
                id2 = CaravanDB.selectCategoria(categoria[i]);
                if (CaravanDB.insertCaravan_has_Category(id, id2) == 0)
                {
                }
                else
                {
                    // Algo deu errado
                }
            }
            Boolean error = false;
            foreach (endereco end in enderecos)
            {
                id2 = AddressDB.selectCidadeEstadoId(end.End_cidade.ToString(), end.End_uf.ToString());
                if (AddressDB.insertEndereco(end.End_bairro, end.End_rua, id2, end.End_tipo) == 0)
                {
                    id2 = AddressDB.selectEndereco(end.End_bairro, end.End_rua, id2);
                    if (CaravanDB.insertCaravan_has_Address(id, id2) == 0)
                    {
                    }
                    else
                    {
                        // Algo deu errado
                        error = true;
                    }
                }
                else
                {
                    //algo deu errado
                    error = true;
                    break;
                }
            }
            if (error == true)
            {
                // Deu tudo errado!
            }
            else
            {
                if (UserDB.insertUserIntoCaravan(id, car.Usu_car_criador) == 0)
                {
                    Session["CaravanID"] = id;
                    ltl_status.Text      = "<script type='text/javascript'> swal('Sucesso!', 'Você será redirecionado a página da Caravana', 'success')";
                    ltl_status.Text     += ".then((value) => {window.location.replace('Caravana_Criador.aspx')}); </script> ";
                }
                else
                {
                }
            }
        }
        else
        {
            // Algo deu errado
        }
    }
コード例 #16
0
 //to Insert in the address table
 public static void InsertInAddress(AddressData objAddressDate)
 {
     AddressDB.InsertInAddress(objAddressDate);
 }
コード例 #17
0
    protected void btnAvancar1_Click(object sender, EventArgs e)
    {
        Caravan car = (Caravan)Session["cadastro"];

        endereco[] enderecos = (endereco[])Session["auxiliar"];
        car.Usu_car_criador = Convert.ToInt32(Session["id"]);
        Proposta pro = (Proposta)Session["cadastro2"];

        pro.Pro_status = "Aceito";
        pro.Pro_data   = DateTime.UtcNow;

        if (CaravanDB.insertCaravan2(car) == 0)
        {
            int id = CaravanDB.selectCaravanEmp(car);
            pro.Car_id = id;
            int      id2       = 0;
            string[] categoria = car.Car_categoria.Split(';');
            for (int i = 0; i < categoria.Length; i++)
            {
                id2 = CaravanDB.selectCategoria(categoria[i]);
                if (CaravanDB.insertCaravan_has_Category(id, id2) == 0)
                {
                }
                else
                {
                    // Algo deu errado
                }
            }
            Boolean error = false;
            foreach (endereco end in enderecos)
            {
                id2 = AddressDB.selectCidadeEstadoId(end.End_cidade.ToString(), end.End_uf.ToString());
                if (AddressDB.insertEndereco(end.End_bairro, end.End_rua, id2, end.End_tipo) == 0)
                {
                    id2 = AddressDB.selectEndereco(end.End_bairro, end.End_rua, id2);
                    if (CaravanDB.insertCaravan_has_Address(id, id2) == 0)
                    {
                    }
                    else
                    {
                        // Algo deu errado
                        error = true;
                    }
                }
                else
                {
                    //algo deu errado
                    error = true;
                    break;
                }
            }
            if (error == true)
            {
                // Deu tudo errado!
            }
            else
            {
                int id3 = CompanyDB.MakePropostas(pro);
                if (id3 != 0)
                {
                    if (CompanyDB.insertProposta_has_Motorista(pro, id3) == 0)
                    {
                        if (CompanyDB.insertProposta_has_Veiculo(pro, id3) == 0)
                        {
                            if (CompanyDB.insertCaravana_has_Proposta(pro, id3) == 0)
                            {
                                Session["CaravanID"] = id;
                                ltl_status.Text      = "<script type='text/javascript'> swal('Sucesso!', 'Você será redirecionado a página da Caravana', 'success')";
                                ltl_status.Text     += ".then((value) => {window.location.replace('../ToUser/Caravana.aspx')}); </script> ";
                            }
                            else
                            {
                                // Algo deu errado
                            }
                        }
                        else
                        {
                            // Algo deu errado
                        }
                    }
                    else
                    {
                        // Algo deu errado
                    }
                }
                else
                {
                    // Algo deu erro
                }
            }
        }
        else
        {
            // Algo deu errado
        }
    }
コード例 #18
0
 //to update  in the address table
 public static void UpdateInAddress(AddressData objAddressData)
 {
     AddressDB.UpdateInAddress(objAddressData);
 }
コード例 #19
0
 public static Address GetAddressById(int id)
 {
     return(AddressDB.GetAddressByID(id));
 }
コード例 #20
0
 //list of country for state combobox
 public static object ListOfState(int id)
 {
     return(AddressDB.ListOfState(id));
 }
コード例 #21
0
 public static AddressList GetList()
 {
     return(AddressDB.GetList());
 }
コード例 #22
0
 public bool DeleteAddressByID(int addressID)
 {
     AddressDB addressDB = new AddressDB();
     Address address  = addressDB.GetById(addressID);
     Response<Address> response = address.Delete();
     return response.Success;
 }
コード例 #23
0
 public List<Address> GetAddressesByUserId(int userID)
 {
     AddressDB addressDB = new AddressDB();
     return addressDB.GetByUserId(userID);
 }
コード例 #24
0
 //to delete in the address table
 public static void DeleteInAddress(int addressId)
 {
     AddressDB.DeleteInAddress(addressId);
 }
コード例 #25
0
        public bool ProcessOrder(List<PartOrder> partOrders, string phoneNr, string address)
        {
            //Create the user to be inserted into the database.
            UserDB userDB = new UserDB();
            User user = userDB.GetUserByPhone(phoneNr);

            //if the user does not exist already, create one.
            if (user == null)
            {
                user = new User();
                user.PhoneNumber = phoneNr;
                user.RankID = 0;
                user.Create();
            }

            //Create the address to be inserted into the database.
            AddressDB addressDB = new AddressDB();
            Address userAddress = addressDB.GetByAddress(address);

            //if the address does not exist already, create one.
            if (userAddress == null)
            {
                userAddress = new Address();
                userAddress.UserAddress = address;
                userAddress.UserID = user.ID;
                userAddress.Create();

            }

            //Create the order to be inserted to the database
            Order order = new Order();
            order.AddressID = userAddress.ID;
            order.UserID = user.ID;
            order.StatusID = OrderStatus.WAITING;
            order.Create();

            //The partorders are inserted to the database
            PartOrderDB poDB = new PartOrderDB();

            //For debugging Part Orders when something happens.
            CustomHandlers.DatabaseLibrary.Response<PartOrder> r = poDB.CreateBatch(order.ID, partOrders);
            foreach (string s in r.Messages)
            {
                Console.WriteLine(s);
            }

            return r.Success;
        }
コード例 #26
0
 //filtered list for AddressBook
 public static object FilteredAddressbook(int id, bool status)
 {
     return(AddressDB.FilteredAddress(id, status));
 }