Exemplo n.º 1
0
 public Call(int callid, string arrive, string open, string des, string email, string fullnam, string geo, string id, string slov, string ph, string ra, service servic, employee tech)
 {
     this.call_id        = callid;
     this.date_of_arrive = arrive;
     this.date_of_open   = open;
     this.description    = des;
     this.emailofuser    = email;
     this.fullname       = fullnam;
     this.geolocation    = geo;
     this.id             = id;
     this.issolved       = slov;
     this.phone          = ph;
     this.rank           = ra;
     this.serviceid      = servic;
     this.techid         = tech;
 }
 public void del_service(service s)
 {
     del("services/" + s.service_id, "moneServices");
 }
        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("אין חיבור לאינטרנט");
                }
            }
        }