//sing in application
        private void ClickBtnSing(object sender, RoutedEventArgs e)
        {
            try
            {
                string login = this.TxbLogin.Text;

                string password = this.PsbPassword.Password;

                //if check is null, send message for user
                if (!user.CheckFields(login, password))
                {
                    return;
                }

                //authorization user
                if (!user.AuthUser(login, password))
                {
                    return;
                }

                //open MainPage if User has
                SharedClass.OpenNewWindow(new MainWindow(), this);
            }
            catch (Exception ex)
            {
                SharedClass.MessageBoxError(ex.Message);
            }
        }
Example #2
0
        public override void ProcessPayload(Interfaces.IClient Client, Plugin.IPlugin plugin = null)
        {
            lock (Client.Connection.InitializedClasses)
            {
                if (Client.Connection.InitializedClasses.ContainsKey(SharedClassId))
                {
                    SharedClass initClass = Client.Connection.InitializedClasses[SharedClassId];
                    Client.Connection.InitializedClasses[SharedClassId].IsDisposed = true;

                    SharedClass localSharedClass = null;
                    lock (Client.Connection.SharedClasses)
                    {
                        if (Client.Connection.SharedClasses.TryGetValue(initClass.SharedName, out localSharedClass))
                        {
                            localSharedClass.SharedInitializeCounter--;
                        }
                    }

                    Client.Connection.InitializedClasses[SharedClassId] = null;
                    Client.Connection.InitializedClasses.Remove(SharedClassId);
                }
                else
                {
                    //strange client behavior
                    Client.Disconnect();
                }
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            BtnSharedSave.TouchUpInside += delegate {
                sobj = new SharedClass(this);
                sobj.Show();
            };

            btnPCLSave.TouchUpInside += delegate {
                pobj = new PortableClass();

                pobj.OnShow += delegate {
                    UIAlertController alert = UIAlertController.Create("Message", "Data Saved", UIAlertControllerStyle.Alert);

                    // Configure the alert
                    alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, (action) => { }));

                    // Display the alert
                    this.PresentViewController(alert, true, null);
                };

                pobj.Show();

            };

            BtnPCLInterface.TouchUpInside += delegate
            {
                pobj = new PortableClass();
                pobj.ShowAlert(new AlertView(this));
            };
        }
 //add new car in BD
 private void AddCar(object sender, RoutedEventArgs routedEventArgs)
 {
     try
     {
         //check fiels, if have null -> send message for user
         if (Admin.checkVIN(NewCar))
         {
             SharedClass.MessageBoxWarning("Все поля должны быть заполнены");
         }
         else
         {
             //add new user and send message for user
             Admin.AddCar(NewCar);
             SharedClass.MessageBoxInformation("Автомобиль успешно добавлен в базу данных");
             this.Close();
         }
     }
     catch (DbEntityValidationException)
     {
         SharedClass.MessageBoxWarning("Заполните все поля");
     }
     catch (NullReferenceException)
     {
         SharedClass.MessageBoxWarning("Все поля должны быть заполнены");
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #5
0
        public override void ProcessPayload(SSPClient client, OperationalSocket OpSocket)
        {
            LiteCodeClient Client = OpSocket as LiteCodeClient;

            lock (Client.InitializedClasses)
            {
                if (Client.InitializedClasses.ContainsKey(SharedClassId))
                {
                    Client.InitializedClasses[SharedClassId].IsDisposed = true;

                    SharedClass localSharedClass = null;
                    lock (Client.SharedClasses)
                    {
                        if (Client.SharedClasses.TryGetValue(Client.InitializedClasses[SharedClassId].SharedName, out localSharedClass))
                        {
                            localSharedClass.SharedInitializeCounter--;
                        }
                    }

                    Client.InitializedClasses[SharedClassId] = null;
                    Client.InitializedClasses.Remove(SharedClassId);
                }
                else
                {
                    //strange client behavior
                    Client.Disconnect();
                }
            }
        }
 private void SaveEditAboutCar(object sender, RoutedEventArgs routedEventArgs)
 {
     try
     {
         if (!Admin.isSelected(SelectedCar))
         {
             SharedClass.MessageBoxWarning("Выберите автомобиль в таблице");
             return;
         }
         if (Admin.checkVIN(SelectedCar))
         {
             SharedClass.MessageBoxWarning("Все поля должны быть заполнены");
         }
         else
         {
             Controller.Model.SaveChanges();
             SharedClass.MessageBoxInformation("Data Success Edit for selected car");
             UpdateDataGrid();
         }
     }
     catch (NullReferenceException)
     {
         SharedClass.MessageBoxWarning("Все поля должны быть заполнены");
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #7
0
        private void SaveChanges(object sender, RoutedEventArgs e)
        {
            try
            {
                //check fiels, if null -> send message for user
                if (!new Controller.User().CheckFields(Controller.User.AuthorizedUser.Email, Controller.User.AuthorizedUser.Password,
                                                       Controller.User.AuthorizedUser.FirstName, Controller.User.AuthorizedUser.LastName))
                {
                    return;
                }

                Controller.Model.SaveChanges();

                SharedClass.MessageBoxInformation("Данные о пользователе успешно отредактированы");

                //open main menu, for type auth user
                if (new Controller.User().isAdmin())
                {
                    SharedClass.OpenNewPage(this, new View.Admin.MainMenu());
                }
                else
                {
                    SharedClass.OpenNewPage(this, new View.Client.MainMenu());
                }
            }
            catch (Exception ex)
            {
                SharedClass.MessageBoxError(ex);
            }
        }
        private void AuthClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (IsFieldsEmpty())
                {
                    SharedClass.MessageBoxWarning("Все поля должны быть заполнены");
                    return;
                }

                if (userRepo.IsAuth(this.txtLogin.Text.Trim(), this.txtPassword.Text.Trim()))
                {
                    MainWindow mainWindow = new MainWindow();
                    mainWindow.Show();
                    this.Close();
                }
                else
                {
                    SharedClass.MessageBoxWarning($"Неправильный логин или пароль.");
                }
            }
            catch (Exception ex)
            {
                SharedClass.MessageBoxError(ex);
            }
        }
Example #9
0
 private void AuthClick(object sender, RoutedEventArgs e)
 {
     try
     {
         if (this.txtLogin.Text != "" && this.txtPassword.Text != "")
         {
             if (model.IsAuth(this.txtLogin.Text, this.txtPassword.Text))
             {
                 SharedClass.OpenNewPage(this, new MainMenu());
             }
             else
             {
                 SharedClass.MessageBoxWarning("Неправильный логин или пароль");
             }
         }
         else
         {
             SharedClass.MessageBoxWarning("Все поля должны быть заполнены");
         }
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #10
0
        public MainPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;
            SharedClass shared=new SharedClass();
            shared.IncreaseCount();
        }
 private void CheckDataEdit()
 {
     if (SharedClass.ValidText(txt_Name))
     {
         EditData();
         RefForm();
     }
 }
Example #12
0
        public void TestThatMyNameIsChris()
        {
            var theName     = "Chris";
            var sharedclass = new SharedClass();

            var result = sharedclass.SayMyName(theName);

            Assert.AreEqual(string.Format("Your name is {0}", theName), result);
        }
Example #13
0
        private void Start()
        {
            Debug.Log(SharedClass.GetText());

            using (new ConsoleRedirector())
            {
                SharedClass.DoSomething();
            }
        }
 private void BackClick(object sender, RoutedEventArgs e)
 {
     try {
         SharedClass.OpenNewPage(this, new ListClients());
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #15
0
 private void AddNewRent(object sender, RoutedEventArgs eventArgs)
 {
     try
     {
         this.MainFrame.Content = new View.Client.AddNewRent();
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #16
0
 //edit data for account
 private void SettingsAccount(object sender, RoutedEventArgs e)
 {
     try
     {
         this.MainFrame.Content = new View.User.SettingsAccount();
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #17
0
 private void Statistick(object sender, RoutedEventArgs eventArgs)
 {
     try
     {
         this.MainFrame.Content = new View.Admin.Statistick();
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #18
0
 public Auth()
 {
     try
     {
         InitializeComponent();
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
 private void ValidateAdd()
 {
     if (SharedClass.ValidText(txt_Name))
     {
         SaveData();
     }
     else
     {
         MessageBox.Show(SharedClass.Check_Message);
     }
 }
Example #20
0
 private void AddNewRent(object sender, RoutedEventArgs routedEventArgs)
 {
     try
     {
         SharedClass.OpenNewPage(this, new View.Client.AddNewRent());
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #21
0
 private void LoadDataGrid()
 {
     try
     {
         this.ListRentCarsForUser.ItemsSource = Client.getListRentForUser(CarSharing.Controller.User.AuthorizedUser);
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #22
0
 public AddNewRent()
 {
     try
     {
         InitializeComponent();
         SetStartTextBlocks();
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #23
0
 public MainMenu()
 {
     try
     {
         InitializeComponent();
         LoadDataGrid();
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
 //update data in DataGrid
 private void UpdateDataGrid()
 {
     try
     {
         this.ListCars.ItemsSource = null;
         this.ListCars.ItemsSource = Admin.getListCars();
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #25
0
 private void ChechValid()
 {
     if (combo_Group.SelectedIndex >= 0 && SharedClass.ValidText(txt_Name) && SharedClass.ValidText(txt_Adress) && SharedClass.ValidText(txt_Phone))
     {
         SaveData();
         RefForm();
     }
     else
     {
         MessageBox.Show(SharedClass.Check_Message);
     }
 }
 private void bt_edit_Click(object sender, EventArgs e)
 {
     if (SharedClass.ValidText(txt_Name) && SharedClass.ValidText(txt_Start) && SharedClass.ValidText(txt_End))
     {
         EditData();
         RefForm();
     }
     else
     {
         MessageBox.Show(SharedClass.Check_Message);
     }
 }
 //open window for add Car and Update data in DataGrid
 private void AddNewCar(object sender, RoutedEventArgs routedEventArgs)
 {
     try
     {
         new View.Admin.AddNewCar().ShowDialog();
         UpdateDataGrid();
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
 public ListOfCars()
 {
     try
     {
         InitializeComponent();
         LoadDataAboutCars();
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Example #29
0
 private void ChechValid()
 {
     if (SharedClass.ValidText(txt_Name) && SharedClass.ValidText(txt_Address) && SharedClass.ValidText(txt_Clinic) && SharedClass.ValidText(txt_Phone) && SharedClass.ValidText(txt_special))
     {
         SaveData();
         RefForm();
     }
     else
     {
         MessageBox.Show(SharedClass.Check_Message);
     }
 }
Example #30
0
 private void ChechValid()
 {
     if (SharedClass.ValidText(txt_Name) && SharedClass.ValidText(txt_Unit) && SharedClass.ValidText(txt_Quantity))
     {
         SaveData();
         RefForm();
     }
     else
     {
         MessageBox.Show(SharedClass.Check_Message);
     }
 }
Example #31
0
 private void ChechValidEdit()
 {
     if (SharedClass.ValidText(txt_Name) && SharedClass.ValidText(txt_Unit))
     {
         EditData();
         RefForm();
     }
     else
     {
         MessageBox.Show(SharedClass.Check_Message);
     }
 }
Example #32
0
 /// <summary>
 /// genarate main Window
 /// </summary>
 public MainWindow()
 {
     try
     {
         InitializeComponent();
         SharedClass.SetFrame(this.MainFrame, new ListClients());
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
 protected string getPersonToVisit(object id, SharedClass.RelationType relation)
 {
     using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities())
     {
         var visitingFile = mc.Petient_Visiting_Financials.Where(o => o.Id == (long)id).First();
         var persons = visitingFile.Connectors.Where(o => o.RelationType == SharedClass.GetRelationType(relation)).ToList();
         if (persons.Count() != 0)
         {
             return persons.First().BSI__Clinic_Employees.First_Name + " " + persons.First().BSI__Clinic_Employees.Last_Name;
         }
         else
         {
             return nobody;
         }
     }
 }
 protected string getPersonToVisitValue(object id, SharedClass.RelationType relation)
 {
     using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities())
     {
         var visitingFile = mc.Petient_Visiting_Financials.Where(o => o.Id == (long)id).First();
         var employees = visitingFile.Connectors.Where(o => o.RelationType == SharedClass.GetRelationType(relation)).ToList();
         if (employees.Count() != 0)
         {
             var employee = employees.First().BSI__Clinic_Employees;
             return employee.Id;
         }
         else
         {
             return "";
         }
     }
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button1 = FindViewById<Button>(Resource.Id.SharedButton);

            button1.Click += delegate {
                sobj = new SharedClass(this);
                sobj.Show();
            };

            Button button2 = FindViewById<Button>(Resource.Id.PCLButton);

            button2.Click += delegate
            {
                pobj = new PortableClass();

                pobj.OnShow += delegate
                {
                    Toast.MakeText(this, "Data Saved", ToastLength.Long).Show();
                };

                pobj.Show();

            };

            Button button3 = FindViewById<Button>(Resource.Id.PCLInterfaceButton);

            button3.Click += delegate
            {
                pobj = new PortableClass();
                pobj.ShowAlert(new AlertView(this));
            };
        }
        private void bindDropDownList(ref DropDownList ddl, SharedClass.RelationType relation)
        {
            ddl.Items.Clear();
            var employeesOfSelectedService = ModelClass.GetAllEmployees();
            foreach (var employee in employeesOfSelectedService)
            {
                if (employee.Job_Clinic == SharedClass.GetRelationType(relation))
                {
                    ddl.Items.Add(new ListItem(employee.First_Name + " " + employee.Last_Name, employee.Id));
                }
            }

            if (employeesOfSelectedService.Count() != 0 && SharedClass.IsUserAdminOrOperator(SharedClass.CurrentUser) == true)
            {
                ddl.Items.Add(new ListItem("-", ""));
            }
        }