//protected void BtnUpdate_Click(object sender, EventArgs e)
 //{
 //    bobject = new UserInformation();
 //    blogic = new BusinessLogic.BusinessLogic();
 //    bobject.Id = Convert.ToInt32(Request.QueryString["Id"]);
 //    bobject.Name = TxtName.Text;
 //    bobject.Email = TxtEmail.Text;
 //    bobject.Address = TxtAddress.Text;
 //    bobject.Gender = TxtGender.Text;
 //    bobject.Country = TxtCountry.Text;
 //    bobject.PhoneNumber = Convert.ToInt32(TxtPhone.Text);
 //    blogic.SaveEdit(bobject);
 //    BindData();
 //    ClearFeild();
 //}
 public void BindData()
 {
     bobject = new UserInformation();
     blogic = new BusinessLogic.BusinessLogic();
     List<UserInformation> lst = blogic.ShowData(bobject);
     grd_show.DataSource = lst;
     grd_show.DataBind();
 }
Exemple #2
0
        //static  Logger log = new Logger();
        static void Main(string[] args)
        {
            IBusiness business = new BusinessLogic.BusinessLogic();

            try
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("*****************************************");
                Console.WriteLine("*         Ejecucion de scripts          *");
                Console.WriteLine("*****************************************");
                Console.WriteLine("");
                Console.WriteLine("Desea ejecutar archivos UP(u) o DOWN (d)?");
                tipo = Console.ReadLine();
                if (tipo.Equals("u"))
                {
                    Console.WriteLine("Inicio de archivos UP");
                    business.EjecutarFilesUp();
                }
                else
                {
                    Console.WriteLine("Inicio de archivos DOWN");
                    business.EjecutarFilesDown("d", null);
                }
                Console.Read();
            }
            catch (Exception ex)
            {
                //  log.LogError("Main Down automatico", ex.Message, ex);
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write(ex.Message + " En el archivo " + BusinessLogic.BusinessLogic.nombreScript);
                Console.WriteLine("");
                if (tipo.Equals("u"))
                {
                    Console.WriteLine("¿Desea ejecutar un restore? Ingrese Si(s),No(n)");
                    string respuesta = Console.ReadLine();
                    while (!respuesta.Equals("n") && !respuesta.Equals("s"))
                    {
                        respuesta = Console.ReadLine();
                    }
                    Console.ForegroundColor = ConsoleColor.Green;
                    if (respuesta.Equals("s"))
                    {
                        try
                        {
                            Console.WriteLine("Inicio de proceso DOWN");
                            business.EjecutarFilesDown("d", BusinessLogic.BusinessLogic.nombreScript);
                        }
                        catch (Exception ex2)
                        {
                            //log.LogError("Main Down", ex.Message, ex);
                            Console.WriteLine(ex2.Message);
                        }
                    }
                }
            }
            Console.Read();
        }
        public void DeleteData()
        {
            bobject = new UserInformation();
            blogic = new BusinessLogic.BusinessLogic();

            bobject.Id = Convert.ToInt32(Request.QueryString["DId"]);
            blogic.DeleteData(bobject.Id);
            BindData();
        }
Exemple #4
0
 //protected void linklogout_Click(object sender, EventArgs e)
 //{
 //    Session.Clear();
 //    linklogout.Visible = false;
 //}
 public static bool login2(string memberid, string password)
 {
     //string pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
     BusinessLogic.BusinessLogic bal = new BusinessLogic.BusinessLogic();
     if (bal.Login_Check_Member(memberid, password))
     {
         return true;
     }
     else
         return false;
 }
Exemple #5
0
    //protected void linklogout_Click(object sender, EventArgs e)
    //{
    //    Session.Clear();
    //    linklogout.Visible = false;

    //}
    public static bool login2(string memberid, string password)
    {
        //string pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
        BusinessLogic.BusinessLogic bal = new BusinessLogic.BusinessLogic();
        if (bal.Login_Check_Member(memberid, password))
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
        public void ExecuteMathematicalOperation()
        {
            var operationName = "Addition";
            var parametrs = new[] { 2.2, 3.3 };
            var testResult = "5.5";
            var fileNameAssembly = "base.dll";
            var fullNameType = "base.Operations";

            action.Setup(m => m.Exec(operationName, parametrs, fileNameAssembly, fullNameType)).Returns(testResult);

            var result = calcRpn.ExecMathOperation(operationName, parametrs, fileNameAssembly, fullNameType);

            Assert.Equal("5.5", result);
        }
 protected void BtnAdd_Click(object sender, EventArgs e)
 {
     if (BtnAdd.Text == "Add New")
     {
         bobject = new UserInformation();
         blogic = new BusinessLogic.BusinessLogic();
         bobject.Id = Convert.ToInt32(Request.QueryString["Id"]);
         bobject.Name = TxtName.Text;
         bobject.Email = TxtEmail.Text;
         bobject.Age = TxtAge.Text;
         bobject.Address = TxtAddress.Text;
         bobject.Gender = TxtGender.Text;
         bobject.Country = TxtCountry.Text;
         bobject.PhoneNumber = TxtPhone.Text;
         bobject.DateOfBirth = TxtDateOfBirth.Text;
         bobject.Salary = TxtSalary.Text;
         blogic.AddInfo(bobject);
         BindData();
         ClearFeild();
     }
     else
     {
         bobject = new UserInformation();
         blogic = new BusinessLogic.BusinessLogic();
         bobject.Id = Convert.ToInt32(Request.QueryString["Id"]);
         bobject.Name = TxtName.Text;
         bobject.Email = TxtEmail.Text;
         bobject.Age = TxtAge.Text;
         bobject.Address = TxtAddress.Text;
         bobject.Gender = TxtGender.Text;
         bobject.Country = TxtCountry.Text;
         bobject.PhoneNumber = TxtPhone.Text;
         bobject.DateOfBirth = TxtDateOfBirth.Text;
         bobject.Salary = TxtSalary.Text;
         blogic.SaveEdit(bobject);
         BindData();
         ClearFeild();
         BtnAdd.Text = "Add New";
     }
 }
 public CreateController(BusinessLogic.Services.IFileStorageService fileStorageService)
 {
     this.FileStorageService = fileStorageService;
     this.MaxShareTTL = int.Parse(System.Configuration.ConfigurationManager.AppSettings["MaxLinkLifetime"]);
 }
Exemple #9
0
 public LinkController(BusinessLogic.Services.IFileStorageService fileStorageService)
 {
     this.FileStorageService = fileStorageService;
 }
 void capaRed_EchoMessage(object sender, BusinessLogic.Datos.PingEventArgs e)
 {
     foreach (IVisualizacion vista in _clientes)
     {
         vista.NotificarEchoMessage(Id, e.EsReply, e.IpOrigen, e.Hora);
     }
 }
 private void FillCheque(ForExCheque check, BusinessLogic.ForeignExchange forEx, string amountInWords)
 {
     lblDate.Text = String.Format("{0: MMMM d, yyyy}", check.CheckDate);
     lblName.Text = "***" + forEx.PartyRole1.Party.Name.ToUpper() + "***";
     lblAmount.Text = "***" + check.ForExDetail.Amount.ToString("N") + "***";
     lblAmountInWords.Text = "***" + amountInWords.ToUpper() + " " + "ONLY***";
     var bank = Context.Banks.SingleOrDefault(x => x.PartyRoleId == check.BankPartyRoleId);
     lblBankName.Text = bank.PartyRole.Party.Organization.OrganizationName.ToUpper() + " (" + check.CheckNumber + ")";
     if (check.ForExDetail.Currency.Symbol == "PHP")
         lblCurrency.Text = "PESOS";
     else lblCurrency.Text = check.ForExDetail.Currency.Symbol;
 }
        /// <summary>
        /// Shows order menu with selected orderNumber.
        /// </summary>
        /// <returns>Status</returns>
        /// <param name="order">Order.</param>
        /// <param name="orderNumber">Order number.</param>
        private int OrderMenu(BusinessLogic.Order order, int orderNumber)
        {
            int userOption = 0;
            bool finished = false;

            while (!finished) {
                Console.WriteLine ($"Працюємо із замовленням №{orderNumber}");
                Console.WriteLine (CurrentOrder.ToString ());
                Console.WriteLine ("Виберіть опцію:");
                Console.WriteLine ("1. Видалити замовлення");
                Console.WriteLine ("2. Редагувати замовлення");
                Console.WriteLine ("3. Задати кінцеву ціну (???)");
                Console.WriteLine ("4. Задати номер столика");
                Console.WriteLine ("5. Оформити замовлення");
                CommandPromtWithColor (ConsoleColor.Cyan);
                try {
                    userOption = int.Parse (Console.ReadLine ());
                } catch (FormatException) {
                    Console.WriteLine ("На вході отримано не число.");
                }

                try {
                    switch (userOption) {
                    case 1:
                        orderList.Remove (order);
                        Console.WriteLine ("Поточне замовлення видалене. Повертаємось в головне меню");
                        finished = true;
                        break;
                    case 2:
                        EditOrderDishesMenu (order);
                        break;
                    case 3:
                        Console.Write ("Введіть прийнятне число (в регіональній валюті): ");
                        var newOrderTotalCost = float.Parse (Console.ReadLine ());
                        if (newOrderTotalCost > 0) {
                            order.TotalCost = newOrderTotalCost;
                        } else {
                            throw new ArgumentException ("Сума не може бути від'ємною.");
                        }
                        break;
                    case 4:
                        Console.Write ($"Виберіть номер столика (1-{maximumTableNumber}): ");
                        var tableNumber = int.Parse (Console.ReadLine ());
                        if (tableNumber > 0 && tableNumber <= maximumTableNumber) {
                            order.TableNumber = tableNumber;
                        } else {
                            throw new ArgumentOutOfRangeException ($"Немає столика №{tableNumber}.");
                        }
                        break;
                    case 5:
                        orderList.Add (order);
                        finished = true;
                        break;
                    default:
                        throw new ArgumentOutOfRangeException ("Немає такої опції.");
                    }
                } catch (FormatException) {
                    Console.WriteLine ("В числове поле не можна записати таке значення.");
                } catch (ArgumentOutOfRangeException e) {
                    Console.WriteLine (e.ParamName);
                } catch (Exception e) {
                    Console.WriteLine (e.Message);
                }
            }
            return 1;
        }
        /// <summary>
        /// Shows the specific dish menu in order.
        /// </summary>
        /// <param name="currentOrder">Order.</param>
        private void EditSpecificDishMenuIn(ref BusinessLogic.Order currentOrder)
        {
            bool done = false;

            Console.Write ("Виберіть номер страви для редагування: ");
            try {
                var userOption = int.Parse (Console.ReadLine ()) - 1;
                while (!done) {
                    if (userOption >= 0 && userOption < currentOrder.Dishes.Count) {
                        Console.WriteLine (currentOrder.Dishes.ElementAt (userOption));
                        Console.WriteLine ("1. Додати інгрідієнтів");
                        Console.WriteLine ("2. Видалити інгрідієнти");
                        Console.WriteLine ("3. Змінити інгредієнт");
                        Console.WriteLine ("4. Змінити назву страви");
                        Console.WriteLine ("5. Змінити ціну на страву");
                        Console.WriteLine ("6. Змінити час приготування страви");
                        Console.WriteLine ("7. Повернутися");
                        CommandPromtWithColor (ConsoleColor.Cyan);

                        switch (int.Parse (Console.ReadLine ())) {
                        case 1:
                            Console.WriteLine ("Існуючі інгредієнти: ");
                            DisplayPredefinedIngredients ();
                            do {
                                Console.Write ("Виберіть інгредінти для додавання (розділяйте через один пустий символ) або створіть свій (+): ");
                                var ingredientsInput = Console.ReadLine ().Split (' ');
                                try {
                                    IEnumerable<int> parsedIngedientsInput;
                                    if (ingredientsInput [0].Equals ("+")) {
                                        currentOrder.Dishes.ElementAt (userOption).AddIngredient (CreateIngredientUsing (predefinedIngredients));
                                    } else {
                                        parsedIngedientsInput = ingredientsInput.Select (x => int.Parse (x) - 1);
                                        foreach (var i in parsedIngedientsInput) {
                                            currentOrder.Dishes.ElementAt (userOption).AddIngredient (predefinedIngredients.ElementAt (i));
                                        }
                                    }
                                } catch (Exception) {
                                    Console.WriteLine ("Помилка при додаванні інгредієнтів.");
                                    continue;
                                }
                                break;
                            } while(true);
                            break;
                        case 2:
                            do {
                                Console.Write ("Виберіть номера інгредієнтів для видалення (розділяйте через один пустий символ): ");
                                var ingredientsToRemove = Console.ReadLine ().Split (' ');
                                try {
                                    IEnumerable<int> parsedIngredientsToRemove = ingredientsToRemove.Select (x => int.Parse (x) - 1);
                                    foreach (var i in parsedIngredientsToRemove) {
                                        currentOrder.Dishes.ElementAt (userOption).RemoveIngredientById (i);
                                    }
                                } catch (Exception) {
                                    Console.WriteLine ("Помилка при введенні номерів інгредієнтів для видалення.");
                                    continue;
                                }
                                Console.WriteLine ("Видалення успішне.");
                                break;
                            } while (true);
                            break;

                        case 3:
                            Console.WriteLine (currentOrder.Dishes.ElementAt (userOption).PrintIngredients ());
                            Console.Write ("Номер інгредієнта для зміни: ");

                            try {
                                var ingredientToChange = currentOrder.Dishes.ElementAt (userOption).Ingredients.ElementAt (int.Parse (Console.ReadLine ()) - 1);

                                predefinedIngredients.Remove (ingredientToChange);
                                currentOrder.Dishes.ElementAt (userOption).RemoveIngredient (ingredientToChange);

                                Console.Write ("Нове ім'я: ");
                                var newIngredientName = Console.ReadLine ();
                                Console.Write ("Нова ціна: ");
                                var newIngredientPrice = double.Parse (Console.ReadLine ());

                                var newIngredient = new BusinessLogic.Ingredient (newIngredientName, newIngredientPrice);

                                predefinedIngredients.Add (newIngredient);
                                currentOrder.Dishes.ElementAt (userOption).AddIngredient (newIngredient);

                                Console.WriteLine ("Інгредієнт успішно змінено!");
                            } catch (FormatException) {
                                Console.WriteLine ("Невірний номер інгредієнта. Спробуйте ще раз!");
                            } catch (Exception) {
                                Console.WriteLine ("Помилка при зміні інгрідієнта.");
                                continue;
                            }
                            break;
                        case 4:
                            Console.Write ("Бажане ім'я для страви: ");
                            currentOrder.SetDishName (currentOrder.Dishes.ElementAt (userOption), Console.ReadLine ());
                            break;
                        case 5:
                            do {
                                Console.Write ("Ціна на страву: ");
                                try {
                                    var dishPrice = double.Parse (Console.ReadLine ());
                                    currentOrder.SetDishPrice (currentOrder.Dishes.ElementAt (userOption), dishPrice);
                                } catch (Exception) {
                                    continue;
                                }
                                break;
                            } while(true);
                            break;
                        case 6:
                            Console.Write ("Час приготування: ");
                            var dishTime = double.Parse (Console.ReadLine ());
                            currentOrder.SetDishCookTime (currentOrder.Dishes.ElementAt (userOption), dishTime);
                            Console.WriteLine ("Успішне змінений час приготування!\n");
                            break;
                        case 7:
                            done = true;
                            break;
                        default:
                            throw new ArgumentOutOfRangeException ("Немає такої опції.");
                        }
                        currentOrder.UpdateTotalCost();
                    } else {
                        throw new ArgumentOutOfRangeException ("Немає такої опції.");
                    }
                }
            } catch (FormatException) {
                Console.WriteLine ("На вході отримано не число.");
            } catch (ArgumentOutOfRangeException) {
                Console.WriteLine ("Вихід за межі діапазону.");
            } catch (ArgumentNullException) {
                Console.WriteLine ("Отримано пустий параметр.");
            }
        }
 /// <summary>
 /// Adds the dishes to selected order.
 /// </summary>
 /// <param name="order">Order.</param>
 private void AddDishesTo(BusinessLogic.Order order)
 {
     Console.WriteLine ("Меню: ");
     DisplayPredefinedDishes ();
     Console.WriteLine ("Виберіть страви (перелічуйте через один пустий символ) або створіть нову (+): ");
     do {
         CommandPromtWithColor (ConsoleColor.Cyan);
         try {
             var dishesToAdd = Console.ReadLine ().Split (' ');
             IEnumerable<int> parsedDishesToAdd;
             if (dishesToAdd [0].Equals ("+")) {
                 order.AddDish (CreateDish ());
             } else {
                 parsedDishesToAdd = dishesToAdd.Select (x => int.Parse (x) - 1);
                 foreach (var i in parsedDishesToAdd) {
                     order.AddDish (predefinedDishes [i]);
                 }
             }
         } catch (Exception) {
             Console.WriteLine ("Помилка при доданні страви до замовлення. Спробуйте ще раз!");
             continue;
         }
         break;
     } while(true);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            BindData();
            if(!IsPostBack)
            {
            if (Request.QueryString["Id"] != null)
            {
                bobject = new UserInformation();
                blogic = new BusinessLogic.BusinessLogic();
                bobject.Id = Convert.ToInt32(Request.QueryString["Id"]);
                UserInformation uinfo = new UserInformation();
                uinfo =  blogic.ShowEditData(bobject.Id);
                TxtName.Text = uinfo.Name;
                TxtEmail.Text = uinfo.Email;
                TxtAge.Text = uinfo.Age;
                TxtAddress.Text = uinfo.Address;
                TxtGender.Text = uinfo.Gender;
                TxtCountry.Text = uinfo.Country;
                TxtPhone.Text =( uinfo.PhoneNumber).ToString();
                TxtDateOfBirth.Text = uinfo.DateOfBirth;
                TxtSalary.Text = uinfo.Salary;
                BtnAdd.Text = "Update";

            }
            if (Request.QueryString["DId"] != null)
            {
                DeleteData();
            }
            }
        }
 public AccountMembershipService(BusinessLogic.Membership.PSMembershipProvider provider)
 {
     _provider = provider ?? (PSMembershipProvider)Membership.Providers["SPMSQLProvider"];// Membership.Provider;
 }
        /// <summary>
        /// Shows the edit dishes menu with selected order.
        /// </summary>
        /// <param name="order">Order.</param>
        private void EditOrderDishesMenu(BusinessLogic.Order order)
        {
            bool done = false;
            while (!done) {
                Console.WriteLine ("Страви в замовленні:\n");
                Console.WriteLine (order.PrintDishes ());

                Console.WriteLine ("1. Додати страву");
                Console.WriteLine ("2. Редагувати страву");
                Console.WriteLine ("3. Видалити страву");
                Console.WriteLine ("4. Повернутися");
                CommandPromtWithColor (ConsoleColor.Cyan);
                try {
                    var userOption = int.Parse (Console.ReadLine ());

                    switch (userOption) {
                    case 1:
                        AddDishesTo (order);
                        break;
                    case 2:
                        EditSpecificDishMenuIn (ref order);
                        break;
                    case 3:
                        do {
                            Console.Write ("Виберіть страви (розділяйте одним пустим символом): ");
                            try {
                                var dishesToRemove = Console.ReadLine ().Split (' ');
                                IEnumerable<int> parsedDishesToRemove = dishesToRemove.Select (x => int.Parse (x) - 1);
                                foreach (var i in parsedDishesToRemove) {
                                    order.RemoveDishById (i);
                                }
                                Console.WriteLine ("Видалення успішне.");
                            } catch (Exception) {
                                Console.WriteLine ("Проблема при видаленні страв(и)");
                                continue;
                            }
                            break;
                        } while(true);
                        break;
                    case 4:
                        done = true;
                        break;
                    default:
                        throw new ArgumentOutOfRangeException ("Немає такої опції.");
                    }
                } catch (FormatException) {
                    Console.WriteLine ("На вході отримано не число.");
                } catch (ArgumentOutOfRangeException e) {
                    Console.WriteLine (e.ParamName);
                }
            }
        }