Exemplo n.º 1
0
        public BankBranch RecieveBankBranch(int branchNumber)
        {
            BankBranch bb = DataSource.bankBranches.FirstOrDefault(x => x.BranchNumber == branchNumber);

            return(bb == null ? throw new MissingIdException("BankBranch", branchNumber) : bb.Clone());
        }
        private void btnAdd_Click_1(object sender, RoutedEventArgs e)
        {
            Refresh();
            bool isReturn = false;

            if (txbName.Text == "" || bl.isHaveDigit(txbName.Text))
            {
                lblErrorName.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (txbFamilyName.Text == "" || bl.isHaveDigit(txbFamilyName.Text))
            {
                lblErrorFamilyName.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (!bl.IsValidEmail(txbMail.Text.ToString()))
            {
                lblErrorMail.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (bl.isNotDigit(txbID.Text))
            {
                lblErrorID.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (bl.isNotDigit(txbPhone.Text))
            {
                lblErrorPhone.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (rbtnNo.IsChecked == false & rbtnYes.IsChecked == false)
            {
                lblErrorColectionClearens.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (cmbBank.SelectedIndex < 0)
            {
                lblErrorBank.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (cmbBankBranch.SelectedIndex < 0)
            {
                lblErrorBranch.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (bl.isNotDigit(txbBank.Text))
            {
                lblErrorBankNumber.Visibility = Visibility.Visible;
                isReturn = true;
            }

            if (isReturn)
            {
                return;
            }


            try
            {
                BankBranch bankBranch = new BankBranch()
                {
                    BankNumber    = ((BankBranch)cmbBank.SelectedItem).BankNumber,
                    BankName      = ((BankBranch)cmbBank.SelectedItem).BankName,
                    BranchAddress = ((BankBranch)cmbBankBranch.SelectedItem).BranchAddress,
                    BranchCity    = ((BankBranch)cmbBankBranch.SelectedItem).BranchCity,
                    BranchNumber  = ((BankBranch)cmbBankBranch.SelectedItem).BranchNumber
                };

                host.BankBranchDetails = bankBranch;

                bl.addHost(host);

                Window HostSignIn = new HostSignInWindow(host.HostKey);
                this.Hide();
                HostSignIn.ShowDialog();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "שגיאה");
            }
        }
 public void UpdateBankBranch(BankBranch bankBranch)
 {
     context.SaveChanges();
 }
Exemplo n.º 4
0
 public async Task <BankBranch> SaveAsync(BankBranch bankBranch, CancellationToken token = default(CancellationToken))
 => await addBankBranchQueryProcessor.SaveAsync(bankBranch, token);
Exemplo n.º 5
0
 public Response Update([FromBody] BankBranch value)
 {
     return(repo.Update(value));
 }
 public static int InsertBankBranch(BankBranch theBankBranch)
 {
     return(BankBranchDataAccess.GetInstance.InsertBankBranch(theBankBranch));
 }
Exemplo n.º 7
0
 public BankBranch Create(BankBranch objectToCreate)
 {
     repository.Add(objectToCreate);
     Save();
     return(objectToCreate);
 }
Exemplo n.º 8
0
 public int InsertBankBranch(BankBranch theBankBranch)
 {
     return(BankBranchIntegration.InsertBankBranch(theBankBranch));
 }
Exemplo n.º 9
0
 public int UpdateBankBranch(BankBranch theBankBranch)
 {
     return(BankBranchIntegration.UpdateBankBranch(theBankBranch));
 }
Exemplo n.º 10
0
 public async Task <int> Delete(BankBranch branch, CancellationToken token)
 => await bankBranchProcess.DeleteAsync(branch.CompanyId, branch.BankCode, branch.BranchCode, token);
Exemplo n.º 11
0
 public async Task <BankBranch> Save(BankBranch bankBranch, CancellationToken token)
 => await bankBranchProcess.SaveAsync(bankBranch, token);
Exemplo n.º 12
0
 public BankAccount(BankBranch branch, ID account_number)
 {
     Branch        = branch;
     AccountNumber = account_number;
 }
Exemplo n.º 13
0
        private void done_Click(object sender, RoutedEventArgs e) //creates a hosting unit out of the owners info
        {
            IBL _bl = BL.FactoryBL.getBL();                       //creates an instance of bl
            int temp;

            bool flag       = true;
            bool email_flag = true;

            try
            {
                email_flag = _bl.IsValidEmail(Email.Text);
            }
            catch// (Exception a)
            {
                Email.Clear();
                Email.Text        = "Enter Your Email Address";
                Email.BorderBrush = Brushes.Red;
                flag       = false;
                email_flag = false;
            }

            if (BankInfoTabUserControl.DataGrid.SelectedItem == null)
            {
                //if equals null
                flag = false;
            }

            if (ID.Text == "Enter Your ID")
            {
                flag           = false;
                ID.BorderBrush = Brushes.Red;
            }
            else if (!Int32.TryParse(ID.Text, out temp))
            {
                flag           = false;
                ID.BorderBrush = Brushes.Red;
            }

            if (Fname.Text == "Enter Your First Name")
            {
                flag = false;
                Fname.BorderBrush = Brushes.Red;
            }

            if (Lname.Text == "Enter Your Last Name")
            {
                flag = false;
                Lname.BorderBrush = Brushes.Red;
            }

            if (HUname.Text == "Give Your Property a Name")
            {
                flag = false;
                HUname.BorderBrush = Brushes.Red;
            }


            if (cbSubArea.SelectedValue == null)
            {
                flag = false;
                cbSubArea.Foreground = Brushes.Red;
            }


            if (cbArea.SelectedValue == null)
            {
                flag = false;
                cbArea.Foreground = Brushes.Red;
            }


            if (Beds.Text == "Amount of Beds Your Property has")
            {
                flag             = false;
                Beds.BorderBrush = Brushes.Red;
            }
            else if (!Int32.TryParse(Beds.Text, out temp))
            {
                flag             = false;
                Beds.BorderBrush = Brushes.Red;
            }

            if (Phonenum.Text == "Enter Your Phone Number")
            {
                flag = false;
                Phonenum.BorderBrush = Brushes.Red;
            }
            else if (!Int32.TryParse(Phonenum.Text, out temp))
            {
                flag = false;
                Phonenum.BorderBrush = Brushes.Red;
            }

            if (BankAcctNum.Text == "Enter Your Bank Account Number")
            {
                flag = false;
                BankAcctNum.BorderBrush = Brushes.Red;
            }
            else if (!Int32.TryParse(BankAcctNum.Text, out temp))
            {
                flag = false;
                BankAcctNum.BorderBrush = Brushes.Red;
            }

            if (cbType.SelectedValue == null)
            {
                flag = false;
                cbType.Foreground = Brushes.Red;
            }

            if (lblRating.Text.ToString() == "0")
            {
                flag = false;
                errorStars.Visibility = Visibility.Visible;
            }
            else
            {
                errorStars.Visibility = Visibility.Hidden;
            }


            if (flag)
            {
                HostingUnit hu = new HostingUnit();
                Host        h  = new Host();
                BankBranch  b  = (BankBranch)BankInfoTabUserControl.DataGrid.SelectedItem;

                h.HostKey             = Convert.ToInt32(ID.Text);
                h.PrivateName         = Fname.Text;
                h.FamilyName          = Lname.Text;
                h.PhoneNumber         = Convert.ToInt32(Phonenum.Text);
                h.MailAddress         = Email.Text;
                h.BankBranchDetails   = b;
                h.CollectionClearance = (bool)CollectionClearance.IsChecked;
                h.BankAccountNumber   = Convert.ToInt32(BankAcctNum.Text);

                hu.HostingUnitName      = HUname.Text;
                hu.Owner                = h;
                hu.Area                 = (VacationArea)Enum.Parse(typeof(VacationArea), cbArea.SelectedValue.ToString(), true);
                hu.SubArea              = cbSubArea.SelectedValue.ToString();
                hu.Type                 = (VacationType)Enum.Parse(typeof(VacationType), cbType.SelectedValue.ToString(), true);
                hu.Beds                 = Convert.ToInt32(Beds.Text);
                hu.Pet                  = (bool)Pets.IsChecked;
                hu.WiFi                 = (bool)Wifi.IsChecked;
                hu.Parking              = (bool)Parking.IsChecked;
                hu.Pool                 = (bool)Pool.IsChecked;
                hu.Jacuzzi              = (bool)Jacuzzi.IsChecked;
                hu.Garden               = (bool)Garden.IsChecked;
                hu.ChildrensAttractions = (bool)chiAttract.IsChecked;
                hu.FitnessCenter        = (bool)FitnessCenter.IsChecked;
                hu.Stars                = (StarRating)Enum.Parse(typeof(StarRating), lblRating.Text.ToString(), true);
                try
                {
                    _bl.AddHostingUnit(hu);
                    MessageBox.Show("Here is your new property key code. Please save for future reference.\n Your Key: " + hu.HostingUnitKey, "Important Information", MessageBoxButton.OK, MessageBoxImage.Information);
                    this.NavigationService.Navigate(new MainPage());
                }
                catch (Exception a)
                {
                    MessageBox.Show(a.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("Missing important information, please fill everything out to continue.", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            Console.WriteLine("***function of GuestRequest***\n");
            #region Add new GuestRequest
            Console.WriteLine("* Regular adding of GuestRequest:");
            GuestRequest gr = new GuestRequest
            {
                PrivateName          = "Efrat",
                FamilyName           = "Anconina",
                MailAddress          = "*****@*****.**",
                Status               = true,
                RegistrationDate     = DateTime.Today,
                EntryDate            = new DateTime(2020, 03, 01),
                ReleaseDate          = new DateTime(2020, 03, 06),
                Area                 = Area.North,
                SubArea              = "Emeq Israel",
                Type                 = ResortType.Zimmer,
                Adults               = 1,
                Children             = 0,
                Pool                 = Extra.possible,
                Jacuzzi              = Extra.NotInterested,
                Garden               = Extra.possible,
                ChildrensAttractions = Extra.NotInterested,
                UserName             = "******",
                Password             = "******"
            };
            try
            {
                gr = BL.BLFactory.getBL().AddCustomerReq(gr);
                Console.WriteLine("  " + gr.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("  " + ex.Message);
            }

            Console.WriteLine("  * Try to add exist object of GuestRequest:");
            GuestRequest gr1 = new GuestRequest
            {
                PrivateName          = "Efrat",
                FamilyName           = "Anconina",
                MailAddress          = "*****@*****.**",
                Status               = true,
                RegistrationDate     = DateTime.Today,
                EntryDate            = new DateTime(2020, 03, 01),
                ReleaseDate          = new DateTime(2020, 03, 06),
                Area                 = Area.North,
                SubArea              = "Emeq Israel",
                Type                 = ResortType.Zimmer,
                Adults               = 1,
                Children             = 0,
                Pool                 = Extra.possible,
                Jacuzzi              = Extra.NotInterested,
                Garden               = Extra.possible,
                ChildrensAttractions = Extra.NotInterested,
                UserName             = "******",
                Password             = "******"
            };
            try
            {
                gr1 = BL.BLFactory.getBL().AddCustomerReq(gr1);
                Console.WriteLine("    " + gr1.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
            }

            Console.WriteLine("  * Try to add GuestRequest in invalid dates:");
            GuestRequest gr2 = new GuestRequest
            {
                PrivateName          = "Hadar",
                FamilyName           = "sofayov",
                MailAddress          = "*****@*****.**",
                Status               = true,
                RegistrationDate     = DateTime.Today,
                EntryDate            = new DateTime(2020, 03, 01),
                ReleaseDate          = new DateTime(2020, 03, 01),
                Area                 = Area.North,
                SubArea              = "Emeq Israel",
                Type                 = ResortType.Zimmer,
                Adults               = 1,
                Children             = 0,
                Pool                 = Extra.possible,
                Jacuzzi              = Extra.NotInterested,
                Garden               = Extra.possible,
                ChildrensAttractions = Extra.NotInterested,
                UserName             = "******",
                Password             = "******"
            };
            try
            {
                gr2 = BL.BLFactory.getBL().AddCustomerReq(gr2);
                Console.WriteLine("    " + gr2.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
            }
            #endregion
            #region update GuestRequest
            Console.WriteLine("* Regular updating of GuestRequest:");
            gr.PrivateName = "Simha";
            gr.FamilyName  = "Ben-David";
            try
            {
                gr = BL.BLFactory.getBL().UpdateCustomerReq(gr);
                Console.WriteLine("  " + gr.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("  " + ex.Message);
            }
            Console.WriteLine("  * Updating new GuestRequest:");
            GuestRequest gr3 = new GuestRequest
            {
                PrivateName          = "Hadar",
                FamilyName           = "sofayov",
                MailAddress          = "*****@*****.**",
                Status               = true,
                RegistrationDate     = DateTime.Today,
                EntryDate            = new DateTime(2020, 11, 01),
                ReleaseDate          = new DateTime(2020, 11, 10),
                Area                 = Area.North,
                SubArea              = "Emeq Israel",
                Type                 = ResortType.Zimmer,
                Adults               = 1,
                Children             = 0,
                Pool                 = Extra.possible,
                Jacuzzi              = Extra.NotInterested,
                Garden               = Extra.possible,
                ChildrensAttractions = Extra.NotInterested,
                UserName             = "******",
                Password             = "******"
            };
            try
            {
                BL.BLFactory.getBL().UpdateCustomerReq(gr3);
                Console.WriteLine("    " + gr3.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
                Console.WriteLine("    " + gr3.ToString());
            }
            #endregion

            Console.WriteLine("\n*********************************************************\n");

            Console.WriteLine("***function of HostingUnit***\n");
            #region Add hosting unit
            Console.WriteLine("* Regular adding of HostingUnit:");
            BankBranch bb = new BankBranch
            {
                BankNumber = 11,
                //BankName = "Yahav",
                BranchNumber  = 7,
                BranchCity    = "Afula",
                BranchAddress = "Hazait 35"
            };
            Host h = new Host
            {
                PrivateName         = "Hadar",
                FamilyName          = "Cohen",
                PhoneNumber         = 0504158113,
                MailAddress         = "*****@*****.**",
                BankBranchDetails   = bb,
                BankAccountNumber   = 154785632,
                CollectionClearance = false,
                UserName            = "******",
                Password            = "******"
            };
            HostingUnit hu = new HostingUnit
            {
                Owner                = h,
                HostingUnitName      = "Wow sel zimmer",
                Diary                = new bool[12, 31],
                Area                 = Area.North,
                Type                 = ResortType.Zimmer,
                Adults               = 1,
                Children             = 0,
                Pool                 = true,
                Jacuzzi              = false,
                Garden               = false,
                ChildrensAttractions = true,
            };
            try
            {
                hu = BL.BLFactory.getBL().AddHostingUnit(hu);
                Console.WriteLine("  " + hu.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("  * Try to add exist object of HostingUnit:");
            BankBranch bb1 = new BankBranch
            {
                BankNumber = 11,
                //BankName = "Yahav",
                BranchNumber  = 7,
                BranchCity    = "Afula",
                BranchAddress = "Hazait 35"
            };
            Host h1 = new Host
            {
                PrivateName         = "Hadar",
                FamilyName          = "Cohen",
                PhoneNumber         = 0504158113,
                MailAddress         = "*****@*****.**",
                BankBranchDetails   = bb1,
                BankAccountNumber   = 154785632,
                CollectionClearance = false,
                UserName            = "******",
                Password            = "******"
            };
            HostingUnit hu1 = new HostingUnit
            {
                Owner                = h1,
                HostingUnitName      = "Wow sel zimmer",
                Diary                = new bool[12, 30],
                Area                 = Area.North,
                Type                 = ResortType.Zimmer,
                Adults               = 1,
                Children             = 0,
                Pool                 = true,
                Jacuzzi              = false,
                Garden               = false,
                ChildrensAttractions = true,
            };
            try
            {
                hu1 = BL.BLFactory.getBL().AddHostingUnit(hu1);
                Console.WriteLine("    " + hu1.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
            }
            #endregion
            #region Update hosting unit
            Console.WriteLine("* Regular updating of Hosting Unit:");
            hu.HostingUnitName   = "HaZimmer sel mis cohen! ";
            hu.Owner.PrivateName = " mispahat";
            //hu.Owner.BankBranchDetails.BankName = "Discount";
            hu.Owner.CollectionClearance = true;
            try
            {
                BL.BLFactory.getBL().UpdateHostingUnit(hu);
                Console.WriteLine("  " + hu.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("  " + ex.Message);
            }

            Console.WriteLine("  * Try to update new hosting unit:");
            BankBranch b1 = new BankBranch
            {
                BankNumber = 41,
                //BankName = "Hapualim",
                BranchNumber  = 93,
                BranchCity    = "Jerusalem",
                BranchAddress = "Hazait 35"
            };
            Host hh1 = new Host
            {
                PrivateName         = "Tamar",
                FamilyName          = "Grinblat",
                PhoneNumber         = 0589632589,
                MailAddress         = "*****@*****.**",
                BankBranchDetails   = b1,
                BankAccountNumber   = 12695548,
                CollectionClearance = true,
                UserName            = "******",
                Password            = "******"
            };
            HostingUnit huhu1 = new HostingUnit
            {
                Owner                = hh1,
                HostingUnitName      = "HaZimmer Sal Tamary!",
                Diary                = new bool[12, 31],
                Area                 = Area.Jerusalem,
                Type                 = ResortType.Zimmer,
                Adults               = 1,
                Children             = 0,
                Pool                 = true,
                Jacuzzi              = true,
                Garden               = false,
                ChildrensAttractions = false,
            };
            try
            {
                BL.BLFactory.getBL().UpdateHostingUnit(huhu1);
                Console.WriteLine("    " + huhu1.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
                Console.WriteLine("    " + huhu1.ToString());
            }
            Console.WriteLine("  * Try to update collection clearance of hosting unit with open order:");
            Order or1 = new Order
            {
                HostingUnitKey  = huhu1.HostingUnitKey,
                GuestRequestKey = gr.GuestRequestKey,
                Status          = OrderStatus.NotAddressed,
                CreateDate      = DateTime.Today
            };
            try
            {
                or1 = BL.BLFactory.getBL().AddOrder(or1);
                huhu1.Owner.CollectionClearance = false;
                BL.BLFactory.getBL().UpdateHostingUnit(huhu1);
                Console.WriteLine("    " + or1.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
                //Console.WriteLine("    " + or1.ToString());
            }
            #endregion
            #region Deleting hosting unit
            Console.WriteLine("* Regular deleting of Hosting Unit:");
            try
            {
                BL.BLFactory.getBL().DeleteHostingUnit(hu);
                Console.WriteLine("  Bye Bye to: " + hu.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("  " + ex.Message);
            }
            Console.WriteLine("  * Try to deleting the same Hosting Unit:");
            try
            {
                BL.BLFactory.getBL().DeleteHostingUnit(hu);
                Console.WriteLine("    Bye Bye to: " + hu.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
            }
            Console.WriteLine("  * Try to deleting new Hosting Unit:");
            BankBranch bb2 = new BankBranch
            {
                BankNumber = 12,
                //BankName = "leumi",
                BranchNumber  = 98,
                BranchCity    = "kiriyat-gat",
                BranchAddress = "HaEzel 76"
            };
            Host h2 = new Host
            {
                PrivateName         = "Michal",
                FamilyName          = "GiGi",
                PhoneNumber         = 0504158113,
                MailAddress         = "*****@*****.**",
                BankBranchDetails   = bb2,
                BankAccountNumber   = 98456325,
                CollectionClearance = true,
                UserName            = "******",
                Password            = "******"
            };
            HostingUnit hu2 = new HostingUnit
            {
                Owner                = h2,
                HostingUnitName      = "GiGi Hadid ltd",
                Diary                = new bool[12, 31],
                Area                 = Area.South,
                Type                 = ResortType.AccommodationApartment,
                Adults               = 1,
                Children             = 0,
                Pool                 = true,
                Jacuzzi              = true,
                Garden               = true,
                ChildrensAttractions = false,
            };
            try
            {
                BL.BLFactory.getBL().DeleteHostingUnit(hu2);
                Console.WriteLine("    Bye Bye to: " + hu.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
            }
            Console.WriteLine("   * Try to delete hosting unit with open order");
            try
            {
                BL.BLFactory.getBL().DeleteHostingUnit(huhu1);
                Console.WriteLine("  Bye Bye to: " + hu.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
            }

            #endregion

            Console.WriteLine("\n*********************************************************\n");

            Console.WriteLine("***functions of order***\n");
            #region Add Order

            Console.WriteLine("* Regular adding of new order:");
            BL.BLFactory.getBL().AddHostingUnit(hu2);
            Order or = new Order
            {
                HostingUnitKey  = hu2.HostingUnitKey,
                GuestRequestKey = gr3.GuestRequestKey,
                Status          = OrderStatus.NotAddressed,
                CreateDate      = DateTime.Today,
            };
            try
            {
                or = BL.BLFactory.getBL().AddOrder(or);
                Console.WriteLine("  " + or.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("  " + ex.Message);
                Console.WriteLine("  " + or.ToString());
            }

            Console.WriteLine("  * Try adding exist order:");
            try
            {
                or = BL.BLFactory.getBL().AddOrder(or);
                Console.WriteLine("  " + or.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
            }

            Console.WriteLine("  * Try adding order in booked-up hosting unit:");
            GuestRequest gr4 = new GuestRequest
            {
                PrivateName          = "Nomi",
                FamilyName           = "Ben-David",
                MailAddress          = "*****@*****.**",
                Status               = true,
                RegistrationDate     = DateTime.Today,
                EntryDate            = new DateTime(2020, 03, 03),
                ReleaseDate          = new DateTime(2020, 03, 05),
                Area                 = Area.North,
                SubArea              = "Emeq Israel",
                Type                 = ResortType.Zimmer,
                Adults               = 1,
                Children             = 0,
                Pool                 = Extra.possible,
                Jacuzzi              = Extra.NotInterested,
                Garden               = Extra.possible,
                ChildrensAttractions = Extra.NotInterested,
                UserName             = "******",
                Password             = "******"
            };
            gr4 = BL.BLFactory.getBL().AddCustomerReq(gr4);
            Order or2 = new Order
            {
                HostingUnitKey  = hu2.HostingUnitKey,
                GuestRequestKey = gr4.GuestRequestKey,
                Status          = OrderStatus.NotAddressed,
                CreateDate      = DateTime.Today,
            };
            try
            {
                or = BL.BLFactory.getBL().AddOrder(or);
                Console.WriteLine("    " + or.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
            }
            #endregion
            #region Update Order
            Console.WriteLine("* Regular updating of order:");
            or.CreateDate = new DateTime(2020, 10, 02);
            or.Status     = OrderStatus.ClosedForCustomerUnresponsiveness;
            try
            {
                or = BL.BLFactory.getBL().UpdateOrder(or);
                Console.WriteLine("  " + or.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("  " + ex.Message);
                if (ex.item != null)
                {
                    Console.WriteLine("  " + ex.item.ToString());
                }
            }

            Console.WriteLine("  * Try to update new order:");

            hu = BL.BLFactory.getBL().AddHostingUnit(hu);
            Order or3 = new Order
            {
                HostingUnitKey  = hu.HostingUnitKey,
                GuestRequestKey = gr3.GuestRequestKey,
                Status          = OrderStatus.NotAddressed,
                CreateDate      = DateTime.Today,
            };
            try
            {
                or3 = BL.BLFactory.getBL().UpdateOrder(or3);
                Console.WriteLine("    " + or3.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
                if (ex.item != null)
                {
                    Console.WriteLine("    " + ex.item.ToString());
                }
            }

            Console.WriteLine("  * Try to update closed order:");
            or.Status = OrderStatus.ClosedForCustomerUnresponsiveness;
            try
            {
                or = BL.BLFactory.getBL().UpdateOrder(or);
                Console.WriteLine("    " + or.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
                if (ex.item != null)
                {
                    Console.WriteLine("    " + ex.item.ToString());
                }
            }
            Console.WriteLine("  * Try to update orderStatus to 'sentMail' when collectionClearance isn't arranged:");
            or3.Status = OrderStatus.SentEmail;
            try
            {
                or3 = BL.BLFactory.getBL().UpdateOrder(or3);
                Console.WriteLine("    " + or.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
                if (ex.item != null)
                {
                    Console.WriteLine("    " + ex.item.ToString());
                }
            }
            Console.WriteLine("  * Try to update orderStatus to 'sentMail':");
            Order or4 = new Order
            {
                HostingUnitKey  = hu2.HostingUnitKey,
                GuestRequestKey = gr.GuestRequestKey,
                Status          = OrderStatus.NotAddressed,
                CreateDate      = DateTime.Today,
            };
            BL.BLFactory.getBL().AddOrder(or4);
            or4.Status = OrderStatus.SentEmail;
            try
            {
                or4 = BL.BLFactory.getBL().UpdateOrder(or4);
                Console.WriteLine("    " + or4.ToString());
            }
            catch (MyException ex)
            {
                Console.WriteLine("    " + ex.Message);
                if (ex.item != null)
                {
                    Console.WriteLine("    " + ex.item.ToString());
                }
            }
            #endregion

            Console.WriteLine("\n*********************************************************\n");

            Console.WriteLine("***list returns functions***\n");
            #region Printing List
            Console.WriteLine("* All Hosting Units in this website:");
            foreach (HostingUnit item in BL.BLFactory.getBL().AllHostingUnits())
            {
                Console.WriteLine(" * " + item.ToString());
            }
            Console.WriteLine("\n* All Guest Requests in this website:");
            foreach (GuestRequest item in BL.BLFactory.getBL().AllGuestRequests())
            {
                Console.WriteLine(" * " + item.ToString());
            }
            Console.WriteLine("\n* All Orders in this website:");
            foreach (Order item in BL.BLFactory.getBL().AllOrders())
            {
                Console.WriteLine(" * " + item.ToString());
            }
            Console.WriteLine("\n* All Bank Branches in this website:");
            foreach (BankBranch item in BL.BLFactory.getBL().AllBankBranch())
            {
                Console.WriteLine(" * " + item.ToString());
            }
            #endregion

            Console.WriteLine("\n*********************************************************\n");

            Console.WriteLine("***Special functions for the ibl interface***\n");
            #region Special
            Console.WriteLine("* All the hostingUnits that available in this dates,");
            DateTime dt1     = DateTime.Today;
            int      numDays = 20;
            DateTime dt2     = dt1.AddDays(numDays);
            string   s1      = String.Format("{0:MM/dd/yyyy}", dt1);
            string   s2      = String.Format("{0:MM/dd/yyyy}", dt2);
            Console.WriteLine("  from: " + s1 + " to: " + s2);
            foreach (HostingUnit item in BL.BLFactory.getBL().AvailableHostingUnit(dt1, numDays))
            {
                Console.WriteLine(" * " + item.ToString());
            }

            Console.WriteLine("* The num of pased days bitween: ");
            DateTime dt3 = new DateTime(2020, 05, 06);
            DateTime dt4 = new DateTime(2020, 12, 02);
            string   s3  = String.Format("{0:MM/dd/yyyy}", dt1);
            string   s4  = String.Format("{0:MM/dd/yyyy}", dt2);
            Console.WriteLine("  from: " + s3 + " to: " + s3 + "  = " + BL.BLFactory.getBL().PassedDays(dt3, dt4) + " days.");

            Console.WriteLine("* List of all the expired orders: ");
            try
            {
                List <Order> newList = BL.BLFactory.getBL().AllExpiredOrders(0);
                foreach (Order item in newList)
                {
                    Console.WriteLine("  * " + item.ToString());
                }
            }
            catch (MyException ex)
            {
                Console.WriteLine("  " + ex.Message);
            }

            #endregion

            Console.ReadKey();
        }
Exemplo n.º 15
0
 public static BankBranchModel ToModel(this BankBranch entity)
 {
     return(AutoMapperConfiguration.Mapper.Map <BankBranch, BankBranchModel>(entity));
 }
Exemplo n.º 16
0
 public int DeleteBankBranch(BankBranch theBankBranch)
 {
     return(BankBranchIntegration.DeleteBankBranch(theBankBranch));
 }
Exemplo n.º 17
0
 public static BankBranch ToEntity(this BankBranchModel model, BankBranch destination)
 {
     return(AutoMapperConfiguration.Mapper.Map(model, destination));
 }
Exemplo n.º 18
0
 public async Task <BankBranch> Update(BankBranch bankBranch)
 {
     throw new NotImplementedException();
 }
 public static int DeleteBankBranch(BankBranch theBankBranch)
 {
     return(BankBranchDataAccess.GetInstance.DeleteBankBranch(theBankBranch));
 }
Exemplo n.º 20
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                //BankNumber = int.Parse(element.Element("BankNumber").Value),
                //BankName = element.Element("BankName").Value,
                //BranchNumber = int.Parse(element.Element("BranchNumber").Value),
                //BranchAddress = element.Element("BranchAddress").Value,
                //BranchCity = element.Element("BranchCity").Value

                hu.Jacuzzi = jac.IsChecked.Value;
                if ((h.PrivateName.Length == 0) || !(h.PrivateName.All(x => x == ' ' || char.IsLetter(x))) ||
                    (h.FamilyName.Length == 0) || !(h.FamilyName.All(x => x == ' ' || char.IsLetter(x))) ||
                    (hu.HostingUnitName.Length == 0) || !(hu.HostingUnitName.All(x => x == ' ' || char.IsLetter(x))) ||
                    (h.password.Length == 0) || (h.MailAddress.Length == 0) || (id.Text == "0") || (phone2.Text.Length == 0) || (adults1.Text.Length == 0) ||
                    (children1.Text.Length == 0) || (accuont.Text.Length == 0) || (Convert.ToInt32(price1.Text) <= 0))
                {
                    MessageBox.Show("Oops! You forgot to fill some of the details", "Error", MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign);
                    return;
                }
                else
                {
                    if (!mailAddress.Text.EndsWith("@gmail.com") && !mailAddress.Text.EndsWith("@walla.com"))
                    {
                        MessageBox.Show("Mail address is uncorrect", "Error", MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign);
                        return;
                    }
                    if (id.Text.Length != 9)
                    {
                        MessageBox.Show("ID is too short", "Error", MessageBoxButton.OK, MessageBoxImage.Stop, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign);
                        return;
                    }
                    else
                    {
                        if (myBL.checkHostID(h))
                        {
                            List <BankBranch> banks2 = myBL.getBankBranches();
                            var v = from n in myBL.getBankBranches()
                                    where n.BankName == bank.SelectedItem.ToString()
                                    select n;
                            b = v.FirstOrDefault();
                            h.BankBranchDetails = b;
                            hu.Owner            = h;
                            myBL.addHostingUnit(hu);
                            MessageBox.Show(hu.ToString(), "Information", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign);
                        }
                        else
                        {
                            throw new ArgumentException("Uncorrect ID");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK,
                                MessageBoxImage.Error, MessageBoxResult.Cancel, MessageBoxOptions.RightAlign);
            }



            PrivateArea p = new PrivateArea(myBL.FindHost(h.password));

            this.Close();
            p.ShowDialog();
        }
Exemplo n.º 21
0
 public void Update(BankBranch objectToUpdate)
 {
     repository.Update(objectToUpdate);
     Save();
 }
Exemplo n.º 22
0
 public void printAllBranchesOfBank(BankBranch bank)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 23
0
 public Response Add([FromBody] BankBranch value)
 {
     return(repo.Add(value));
 }
 public void SaveBankBranch(BankBranch bankBranch)
 {
     context.Entry(bankBranch).State = EntityState.Added;
     context.SaveChanges();
 }
        private void btnHostUpdate_Click(object sender, RoutedEventArgs e)
        {
            refreshErrorLabels();
            bool isReturn = false;

            if (txbName.Text == "" || bl.isHaveDigit(txbName.Text))
            {
                lblErrorName.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (txbFamilyName.Text == "" || bl.isHaveDigit(txbFamilyName.Text))
            {
                lblErrorFamilyName.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (!bl.IsValidEmail(txbMail.Text.ToString()))
            {
                lblErrorMail.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (bl.isNotDigit(txbPhone.Text))
            {
                lblErrorPhone.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (bl.isNotDigit(txbBank.Text))
            {
                lblErrorBank.Visibility = Visibility.Visible;
                isReturn = true;
            }
            if (cmbBankBranch.SelectedIndex < 0)
            {
                lblErrorBranch.Visibility = Visibility.Visible;
            }


            if (isReturn)
            {
                return;
            }


            try
            {
                BankBranch bankBranch = new BankBranch()
                {
                    BankNumber    = ((BankBranch)cmbBank.SelectedItem).BankNumber,
                    BankName      = ((BankBranch)cmbBank.SelectedItem).BankName,
                    BranchAddress = ((BankBranch)cmbBankBranch.SelectedItem).BranchAddress,
                    BranchCity    = ((BankBranch)cmbBankBranch.SelectedItem).BranchCity,
                    BranchNumber  = ((BankBranch)cmbBankBranch.SelectedItem).BranchNumber
                };

                host.BankBranchDetails = bankBranch;

                bl.updateHost(host);
                refreshHost();
                MessageBox.Show("עודכן בהצלחה", "", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.None, MessageBoxOptions.RtlReading);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.None, MessageBoxOptions.RtlReading);
            }
        }
Exemplo n.º 26
0
        public HostWin(Host h, string st, string langu)
        {
            InitializeComponent();
            if (langu == "hebrow")
            {
                ChangeL();
            }
            if (h != null)
            {
                thisBank    = h.BankBranchDetails;
                thisHost    = h;
                thisHosting = BL.BLFactory.getBL().FindAllThePriviaseHU(thisHost).First();
            }
            else
            {
                thisHosting.Diary          = new bool[12, 31];
                thisHost.BankBranchDetails = thisBank;
            }
            thisHosting.Owner = thisHost;
            this.DataContext  = thisHosting;

            listb = BL.BLFactory.getBL().AllBankBranch();

            MyState            = st;
            cbBank.ItemsSource = (from item in listb
                                  select item.BankName).Distinct().ToList();
            //cbBank.DisplayMemberPath = "BankName";
            cmbType.ItemsSource = Enum.GetValues(typeof(BE.ResortType));
            cmbArea.ItemsSource = Enum.GetValues(typeof(BE.Area));

            switch (MyState)
            {
            case "add":
            {
                tbHU.IsEnabled           = false;
                tbPotOrd.IsEnabled       = false;
                this.DataContext         = thisHost;
                DtgrdAllHU.Visibility    = Visibility.Collapsed;
                btnAddNewHost.Visibility = Visibility.Collapsed;
                btnUpdate.Visibility     = Visibility.Collapsed;
                btnDelete.Visibility     = Visibility.Collapsed;
                break;
            }

            case "show":
            {
                //thisHost=
                cmbHU.ItemsSource       = BL.BLFactory.getBL().FindAllThePriviaseHU(thisHost);
                cmbHU.DisplayMemberPath = "HostingUnitName";
                this.DataContext        = h;
                btnAddNew.Visibility    = Visibility.Collapsed;
                grpBHostD.IsEnabled     = false;
                DtgrdAllHU.ItemsSource  = BL.BLFactory.getBL().FindAllThePriviaseHU(thisHost);
                btnAdd.Visibility       = Visibility.Collapsed;
                break;
            }

            default:
                break;
            }
        }