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("אין אינטרנט");
     }
 }
Beispiel #2
0
        private void okbtn_Click(object sender, RoutedEventArgs e)
        {
            if (f.CheckForInternetConnection())
            {
                if (companynametb.Text != "" && companylogotbt.Text != "")
                {
                    disableallbtns();
                    f.define_project_base("https://ana10project.firebaseio.com");
                    int mone       = f.num_of_mone("company", "mone");
                    int moneForNew = mone + 1;
                    if (editorregisetr == 1)
                    {
                        com = new company(moneForNew, companynametb.Text, companylogotbt.Text);
                    }
                    else
                    {
                        com.setCompnayLogo(companylogotbt.Text);
                        com.setCompnayName(companynametb.Text);
                    }

                    f.comit_company(this.com);
                    if (editorregisetr == 1)
                    {
                        string value = "{\"mone\":" + moneForNew + "}";
                        f.commit("company/", value);
                    }
                    MessageBox.Show("בוצע בהצלחה!");
                    superuser win = new superuser();
                    win.Show();
                    this.Close();
                }
            }
            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("אין חיבור לאינטרנט");
                }
            }
        }