Example #1
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("אין חיבור לאינטרנט");
     }
 }
        /*
         * //////////////////////////////////////////////////////////////////////
         *
         *                        employee section!
         *
         * /////////////////////////////////////////////////////////////////////
         */

        public employee return_employee_by_id(int num)
        {
            employee newone = null;
            int      mone   = removequat(num_of_mone("employees", "moneemployees"));
            var      json   = JsonConvert.DeserializeObject <dynamic>(get("employees/" + num));

            if (json != null)
            {
                string  adress      = json.adress;
                company c           = this.set_Company(removequat(json.companyid));
                string  date        = json.dateofjoin;
                string  firstname   = json.fname;
                string  lastname    = json.lname;
                string  geolocation = json.geolocation;
                int     id_num      = this.removequat(json.id);
                string  pass        = json.password;
                string  phone       = json.phone;
                newone = new employee(num, adress, c, date, firstname, lastname, geolocation, id_num + "", pass, phone + "");
            }


            return(newone);
        }
        public employee faster_getemployeebyid(string json, int id)
        {
            int      flag   = 0;
            employee newone = new employee();
            string   res    = "";

            res = CutME("employees", ",\"moneemployees\"", json);
            res = res.Replace("employees\":{", "");
            string[] strArr    = null;
            char[]   splitchar = { '}' };
            strArr = res.Split(splitchar);
            for (int i = 0; i < strArr.Length; i++)
            {
                if (flag == 0)
                {
                    string[] strArrsec    = null;
                    char[]   splitcharsec = { '{' };
                    if (strArr[i] != "")
                    {
                        strArrsec    = strArr[i].Split(splitcharsec);
                        strArrsec[0] = strArrsec[0].Replace(":", "");
                        strArrsec[0] = strArrsec[0].Replace(",", "");
                        if (removequat(strArrsec[0]) == id)
                        {
                            string[] strArrtre    = null;
                            char[]   splitchartre = { ',' };
                            newone.employee_id        = removequat(strArrsec[0]);
                            strArrtre                 = strArrsec[1].Split(splitchartre);
                            newone.adress             = strArrtre[0];
                            newone.adress             = newone.adress.Replace("\"adress\":", "");
                            newone.adress             = newone.adress.Replace("\"", "");
                            strArrtre[1]              = strArrtre[1].Replace("\"companyid\":", "");
                            strArrtre[1]              = strArrtre[1].Replace("\"", "");
                            newone.company            = fast_getcompanybyid(json, removequat(strArrtre[1]));
                            newone.dateofjoin         = strArrtre[2];
                            newone.dateofjoin         = newone.dateofjoin.Replace("\"dateofjoin\":", "");
                            newone.dateofjoin         = newone.dateofjoin.Replace("\"", "");
                            newone.firstname          = strArrtre[3];
                            newone.firstname          = newone.firstname.Replace("\"fname\":", "");
                            newone.firstname          = newone.firstname.Replace("\"", "");
                            strArrtre[4]              = strArrtre[4].Replace("\"geolocation\":", "");
                            strArrtre[4]              = strArrtre[4].Replace("\"", "");
                            strArrtre[5]              = strArrtre[5].Replace("\"", "");
                            newone.geolocation        = strArrtre[4] + "," + strArrtre[5];
                            strArrtre[6]              = strArrtre[6].Replace("\"id\":", "");
                            strArrtre[6]              = strArrtre[6].Replace("\"", "");
                            newone.employee_id_number = strArrtre[6];
                            strArrtre[9]              = strArrtre[9].Replace("\"lname\":", "");
                            strArrtre[9]              = strArrtre[9].Replace("\"", "");
                            newone.lastname           = strArrtre[9];
                            strArrtre[10]             = strArrtre[10].Replace("\"password\":", "");
                            strArrtre[10]             = strArrtre[10].Replace("\"", "");
                            newone.password           = strArrtre[10];
                            strArrtre[11]             = strArrtre[11].Replace("\"phone\":", "");
                            strArrtre[11]             = strArrtre[11].Replace("\"", "");
                            newone.phone              = strArrtre[11];

                            flag++;
                        }
                    }
                }
            }
            //res = res.Replace("", "");
            return(newone);
        }
 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;
 }