private void deletebtn_Click(object sender, RoutedEventArgs e)
 {
     if (f.CheckForInternetConnection())
     {
         if (MessageBox.Show("לחיצה על אישור תמחק את משתמש זה האם אתה בטוח?", "מחיקת משתמש", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
         {
         }
         else
         {
             f.del("users/" + us.getuserid(), "usersmone");
             MessageBox.Show("נמחק בהצלחה!");
             if (this.editForCompany > 0)
             {
                 compnaymanage win = new compnaymanage(this.com, this.us);
                 win.Show();
                 this.Close();
             }
             else
             {
                 superuser win = new superuser();
                 win.Show();
                 this.Close();
             }
         }
     }
     else
     {
         MessageBox.Show("אין חיבור לאינטרנט");
     }
 }
Ejemplo n.º 2
0
 public void define_combobox()
 {
     if (f.CheckForInternetConnection())
     {
         //int num = f.num_of_mone("users", "usersmone");
         int num = f.faster_getmone(testfortest, "usersmone");
         for (int i = 1; i < num + 1; i++)
         {
             user newoneuse = f.fast_getuserbyid(testfortest, i);
             if (newoneuse != null)
             {
                 if (f.removequat(newoneuse.copmanyID) == f.removequat(this.com.companyID))
                 {
                     user         newone = newoneuse;
                     ComboBoxItem item   = new ComboBoxItem();
                     item.Content = newone.username;
                     item.Tag     = newone.userid;
                     generalcb.Items.Add(item);
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("אין חיבור לרשת");
     }
 }
 public void define_window()
 {
     if (f.CheckForInternetConnection())
     {
         openDateTB.Text        = ca.date_of_open;
         arrivedateTB.Text      = ca.date_of_arrive;
         desLBLans.Content      = ca.description;
         emailtb.Text           = ca.emailofuser;
         fullnameTB.Text        = ca.fullname;
         adressTB.Text          = ca.geolocation;
         arrivedateTB.IsEnabled = false;
         if (f.removequat(this.ca.issolved) == 1)
         {
             this.arrivedateTB.IsEnabled          = false;
             this.emailtb.IsEnabled               = false;
             this.fullnameTB.IsEnabled            = false;
             this.adressTB.IsEnabled              = false;
             this.change_manul_employee.IsEnabled = false;
             this.change_auto_employee.IsEnabled  = false;
             this.finishme.IsEnabled              = false;
         }
         if (ca.techid != null)
         {
             techlblcontent.Content = ca.techid.firstname + " " + ca.techid.lastname;
         }
         else
         {
             techlblcontent.Content = "אין טכנאי ";
         }
     }
     else
     {
         MessageBox.Show("אין חיבור לאינטרנט");
     }
 }
Ejemplo n.º 4
0
 public void define_comboBox()
 {
     if (f.CheckForInternetConnection())
     {
         int mone = f.num_of_mone("employees", "moneemployees");
         for (int i = 1; i < mone + 1; i++)
         {
             if (f.return_employee_by_id(i) != null)
             {
                 if (f.removequat(f.return_employee_by_id(i).company.companyID) == f.removequat(this.com.companyID))
                 {
                     employee     newone = f.return_employee_by_id(i);
                     ComboBoxItem item   = new ComboBoxItem();
                     item.Content = newone.firstname + " " + newone.lastname;
                     item.Tag     = i;
                     generalcb.Items.Add(item);
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("אין חיבור לרשת");
     }
 }
        public MainWindow()
        {
            WindowState = WindowState.Maximized;
            f           = new OvedLi.function();
            if (f.CheckForInternetConnection())
            {
                f.define_project_base("https://ana10project.firebaseio.com");
                this.u1 = f.set_local_user_after_login(f.check_if_username_and_password_are_ok("Admin", "123456"));
                InitializeComponent();
                loadtimeclock.Visibility = Visibility.Hidden;
            }
            else
            {
                MessageBox.Show("אין חיבור לאינטרנט");
            }

            /*
             * //test
             * var client = new RestClient("https://ana10project.firebaseio.com/test/.json");
             * var request = new RestRequest();
             * var strJSONContent = "{\"hit\":\"hit\"}";
             * request.Method = Method.PATCH;
             * request.AddHeader("Accept", "application/json");
             * request.Parameters.Clear();
             * request.AddParameter("application/json", strJSONContent, ParameterType.RequestBody);
             *
             * var response = client.Execute(request);
             *
             * //end test
             */
            int v = 0;
        }
 private void okbtn_Click(object sender, RoutedEventArgs e)
 {
     if (this.mono > 0)
     {
         if (f.CheckForInternetConnection())
         {
             if (selectservicecb.SelectedItem == null)
             {
                 MessageBox.Show("אנא בחר מהרישמה");
             }
             else
             {
                 string     selected    = ((ComboBoxItem)selectservicecb.SelectedItem).Tag.ToString();
                 int        selecttonum = f.removequat(selected);
                 service    se          = f.return_service_by_id(selecttonum);
                 serviceBox sb          = new serviceBox(this.com, this.use, se);
                 sb.Show();
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("אין חיבור לאינטרנט");
         }
     }
     else
     {
         MessageBox.Show("אין רשומות");
     }
 }
 public callsWindow(company c, user e)
 {
     InitializeComponent();
     loadtimeclock.Visibility = Visibility.Hidden;
     WindowState = WindowState.Maximized;
     f.define_project_base("https://ana10project.firebaseio.com");
     this.com = c;
     this.use = e;
     if (!f.CheckForInternetConnection())
     {
         MessageBox.Show("אין חיבור לאינטרנט");
         compnaymanage cm = new compnaymanage(this.com, this.use);
         cm.Show();
         this.Close();
     }
     this.testfortest = f.get("");
     defineAllControllers();
 }
Ejemplo n.º 8
0
 public void checlifeditorregisetr()
 {
     if (f.CheckForInternetConnection())
     {
         if (com == null)
         {
             editorregisetr       = 1;
             this.Title           = "רשום חברה חדשה";
             companynametb.Text   = "שם החברה";
             companylogotbt.Text  = "כתובת הלוגו";
             imagelogo.Visibility = Visibility.Hidden;
             deletebtn.Visibility = Visibility.Hidden;
             imagelogo.IsEnabled  = false;
             deletebtn.IsEnabled  = false;
         }
         else
         {
             editorregisetr      = 0;
             this.Title          = "ערוך חברה";
             companynametb.Text  = com.companyName;
             companylogotbt.Text = com.companyLogo;
             WebClient wc = new WebClient();
             try
             {
                 byte[]               bytes     = wc.DownloadData(com.companyLogo);
                 MemoryStream         ms        = new MemoryStream(bytes);
                 System.Drawing.Image imagelogo = System.Drawing.Image.FromStream(ms);
             }
             catch (Exception e) {  }
             deletebtn.Visibility = Visibility.Visible;
             deletebtn.IsEnabled  = true;
         }
     }
     else
     {
         MessageBox.Show("אין חיבור לאינטרנט");
     }
 }
 //define the company box
 public void defineComboBoxOfTheCompanys()
 {
     if (f.CheckForInternetConnection())
     {
         int monecompany = f.num_of_mone("company", "mone");
         for (int i = 0; i < monecompany + 1; i++)
         {
             if (f.set_Company(i) != null)
             {
                 company      newone = f.set_Company(i);
                 ComboBoxItem item   = new ComboBoxItem();
                 item.Content = newone.companyName;
                 item.Tag     = newone.companyID;
                 companyEditComboBox.SelectedIndex = 0;
                 companyEditComboBox.Items.Add(item);
             }
         }
     }
     else
     {
         MessageBox.Show("אין חיבור לאינטרנט");
     }
 }
 private void loginbtnonclick(object sender, RoutedEventArgs e)
 {
     if (f.CheckForInternetConnection())
     {
         loadtimeclock.Visibility = Visibility.Visible;
         f.define_project_base("https://ana10project.firebaseio.com");
         this.u1 = f.set_local_user_after_login(f.check_if_username_and_password_are_ok(usernameTB.Text, passwordTB.Password.ToString()));
         if (this.u1 != null)
         {
             if (f.removequat(u1.superuser) == 1)
             {
                 MessageBox.Show("ההתחברות בוצעה בהצלחה!");
                 this.passwordTB.IsEnabled = false;
                 this.usernameTB.IsEnabled = false;
                 this.loginbtn.IsEnabled   = false;
                 var superuserwindow = new superuser();
                 superuserwindow.setupTheUser(u1);
                 superuserwindow.Show();
                 this.Close();
                 // MainWindow.Content = new superuser();
             }
             else
             {
                 MessageBox.Show("ההתחברות בוצעה בהצלחה!");
                 this.passwordTB.IsEnabled = false;
                 this.usernameTB.IsEnabled = false;
                 this.loginbtn.IsEnabled   = false;
                 int           comid = f.removequat(u1.copmanyID);
                 compnaymanage cm    = new compnaymanage(f.set_Company(comid), u1);
                 cm.Show();
                 this.Close();
             }
         }
         else
         {
             loadtimeclock.Visibility = Visibility.Hidden;
             MessageBox.Show("שם משתמש או סיסמה שגויים");
         }
     }
     else
     {
         MessageBox.Show("אין חיבור לאינטרנט");
     }
 }
 private void okbtn_Click(object sender, RoutedEventArgs e)
 {
     if (f.CheckForInternetConnection())
     {
         if (checkIfThereIsNOBLankTB() == 0)
         {
             if (CheckIDNo(idtb.Text))
             {
                 employee ee    = new employee();
                 int      getid = f.num_of_mone("employees", "moneemployees");
                 getid++;
                 ee.employee_id        = getid;
                 ee.adress             = adresstb.Text;
                 ee.company            = this.c;
                 ee.dateofjoin         = dateforjoin();
                 ee.employee_id_number = idtb.Text;
                 ee.firstname          = this.fnametb.Text;
                 ee.lastname           = this.lnametb.Text;
                 ee.password           = f.strEncryptred(this.passwordBox.Password.ToString());
                 ee.geolocation        = "32.291347,34.8620103";
                 ee.phone = this.phonetb.Text;
                 f.commit_employee(ee);
                 f.commit("employees", "{\"moneemployees\":" + getid + "}");
                 MessageBox.Show("בוצע בהצלחה!");
                 compnaymanage cm = new compnaymanage(this.c, this.use);
                 cm.Show();
                 this.Close();
             }
             else
             {
                 MessageBox.Show("תעודת זהות אינה תקינה");
             }
         }
         else
         {
             MessageBox.Show("שים לב שיש שדות רקים");
         }
     }
     else
     {
         MessageBox.Show("אין אינטרנט");
     }
 }
Ejemplo n.º 12
0
 private void okbtn_Click(object sender, RoutedEventArgs e)
 {
     loader.Content = "טוען..";
     if (mooo > 0)
     {
         if (f.CheckForInternetConnection())
         {
             string selected = ((ComboBoxItem)generalcb.SelectedItem).Tag.ToString();
             if (editforuser == 0)
             {
                 if (f.removequat(selected) == 0)
                 {
                     edituser ed = new edituser(0);
                     ed.Show();
                     this.Close();
                 }
                 else
                 {
                     edituser ed = new edituser(f.set_Company(f.removequat(selected)));
                     ed.Show();
                     this.Close();
                 }
             }
             if (editforuser == 1 || editforuser == 2)
             {
                 userbox ed = new userbox(f.retrunuserbyid(f.removequat(selected)));
                 ed.Show();
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("אין אינטרנט");
             loader.Content = "";
         }
     }
     else
     {
         MessageBox.Show("אין רשומות");
         loader.Content = "";
     }
 }
Ejemplo n.º 13
0
 private void okbtn_Click(object sender, RoutedEventArgs e)
 {
     if (f.CheckForInternetConnection())
     {
         if (emcb.SelectedItem == null)
         {
             MessageBox.Show("אנא בחר שם מהרשימה");
         }
         else
         {
             string          selected = ((ComboBoxItem)emcb.SelectedItem).Tag.ToString();
             employee        em       = f.return_employee_by_id(f.removequat(selected));
             employeeboxedit ebe      = new employeeboxedit(this.c, this.u, em);
             ebe.Show();
             this.Close();
         }
     }
     else
     {
         MessageBox.Show("אין חיבור לאינטרנט");
     }
 }
Ejemplo n.º 14
0
 private void okbtn_Click(object sender, RoutedEventArgs e)
 {
     if (f.CheckForInternetConnection())
     {
         if (logolink.Text != "")
         {
             this.com.setCompnayLogo(logolink.Text);
             f.comit_company(this.com);
             MessageBox.Show("בוצע בהצלחה");
             compnaymanage win = new compnaymanage(com, use);
             win.Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("לא ניתן להשאיר שדה ריק");
         }
     }
     else
     {
         MessageBox.Show("אין חיבור לאינטרנט");
     }
 }
        public void definition()
        {
            if (f.CheckForInternetConnection())
            {
                this.Title           = "עריכת עובד " + e.firstname + " " + e.lastname;
                this.idnumbertb.Text = e.employee_id_number;
                this.fnametb.Text    = e.firstname;
                this.lnametb.Text    = e.lastname;
                this.adresstb.Text   = e.adress;
                this.phonetb.Text    = e.phone;
                string   geostr = e.geolocation;
                string[] words  = geostr.Split(',');
                geostr         = words[1] + "," + words[0];
                this.gpsglobal = geostr;
                this.locationonmapweb.Visibility = Visibility.Visible;
                this.locationonmapweb.Navigate("https://api.tomtom.com/map/1/staticimage?key=VjsKK4fEUVclIS5slDjs3okAKwrJcOSf&zoom=10&center=" + this.gpsglobal + "& format=jpg&layer=basic&style=main&width=500&height=150&view=Unified");
                this.dtataforjoinkbk.Content += " " + e.dateofjoin;
                this.companylbl.Content      += " \n" + e.company.companyName;
                string testfortest = f.get("");

                int mone = f.faster_getmone(testfortest, "callsmone");
                // f.num_of_mone("calls", "callsmone");
                int   calls      = 0;
                int   closedCall = 0;
                float avg        = 0;
                int   themoney   = 0;
                for (int i = 1; i < mone + 1; i++)
                {
                    //Call temp = f.set_call_by_id(i);
                    Call temp = f.fast_callbyid(testfortest, i);
                    if (temp != null)
                    {
                        if (temp.techid != null)
                        {
                            if (f.removequat(temp.techid.employee_id) == f.removequat(e.employee_id))
                            {
                                calls++;
                                if (f.removequat(temp.issolved) == 1)
                                {
                                    avg += f.removequat(temp.rank);
                                    closedCall++;
                                    themoney += f.removequat(temp.serviceid.price);
                                }
                            }
                        }
                    }
                }
                this.opencalltotal.Content += " " + calls;
                this.closedcall.Content    += " " + closedCall;
                if (avg != 0)
                {
                    this.rankavg.Content += " \n" + ((avg) / closedCall) + "/5";
                }
                else
                {
                    this.rankavg.Content += " \n 5/5";
                }
                this.money.Content += " " + themoney;
            }
            else
            {
                MessageBox.Show("אין חיבור לאינטרנט");
            }
        }
        private void okbtn_Click(object sender, RoutedEventArgs e)
        {
            //checks setp
            string name            = this.nametb.Text;
            int    flagForExeption = 0;
            int    parsedValue;
            int    price = 0;
            int    time  = 0;

            if (!int.TryParse(this.pricetb.Text, out parsedValue))
            {
                MessageBox.Show("מחיר יכול להיות מספר או מספר שלם בלבד");
                flagForExeption++;
            }
            else
            {
                price = f.removequat(this.pricetb.Text);
            }
            if (!int.TryParse(this.timetb.Text, out parsedValue))
            {
                MessageBox.Show("זמן יכול להיות מספר או מספר שלם בלבד");
                flagForExeption++;
            }
            else
            {
                time = f.removequat(this.timetb.Text);
            }
            if (name == "" || this.pricetb.Text == "" || this.timetb.Text == "")
            {
                MessageBox.Show("השדות לא יכולים להיות ריקים");
                flagForExeption++;
            }
            if (flagForExeption == 0)
            {
                if (price <= 0)
                {
                    MessageBox.Show("המחיר חייב להיות גדול מ0");
                    flagForExeption++;
                }
                if (time <= 0)
                {
                    MessageBox.Show("הזמן חייב להיות גדול מ0");
                    flagForExeption++;
                }
            }
            if (flagForExeption == 0)
            {
                if (f.CheckForInternetConnection())
                {
                    if (this.editforuse == 0)
                    {
                        int mone = 0;
                        mone    = f.removequat(f.num_of_mone("services", "moneServices"));
                        this.se = new service(mone + 1, this.com, name, price, time);
                        f.commit_service(this.se);
                        //add to mone +1
                        mone++;
                        f.commit("services", "{\"moneServices\":" + mone + "}");
                    }
                    if (this.editforuse == 1)
                    {
                        this.se.name  = name;
                        this.se.price = f.removequat(price);
                        this.se.time  = f.removequat(time);

                        f.commit_service(this.se);
                        //add to mone +1
                    }
                    MessageBox.Show("בוצע בהצלחה");
                    compnaymanage cm = new compnaymanage(this.com, this.use);
                    cm.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("אין חיבור לאינטרנט");
                }
            }
        }