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;
        }
        public superuser()
        {
            f = new function();
            f.define_project_base("https://ana10project.firebaseio.com");
            WindowState = WindowState.Maximized;
            InitializeComponent();
            defineComboBoxOfTheCompanys();
            //insert

            // companyEditComboBox.Items.Add()
        }
示例#3
0
        public void define_stats()
        {
            int      services_counter = 0;
            int      open_call        = 0;
            int      closed_call      = 0;
            int      money            = 0;
            int      mone_users       = 0;
            int      mone_employeee   = 0;
            function f = new function();

            f.define_project_base("https://ana10project.firebaseio.com");
            string testfortest = f.get("");
            var    json        = JsonConvert.DeserializeObject <dynamic>(testfortest);
            //var jsonemployees = JsonConvert.DeserializeObject<dynamic>(json.calls.ChildrenTokens[0]);
            int mone = f.faster_getmone(testfortest, "moneemployees");

            //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.faster_getemployeebyid(testfortest, i) != null)
                {
                    if (f.removequat(f.faster_getemployeebyid(testfortest, i).company.companyID) == f.removequat(this.com.companyID))
                    {
                        mone_employeee++;
                    }
                }
            }
            this.employstslbl.Content += mone_employeee + "";

            //mone = f.num_of_mone("users", "usersmone");
            mone = f.faster_getmone(testfortest, "usersmone");
            for (int i = 1; i < mone + 1; i++)
            {
                //if(f.retrunuserbyid(i)!=null)
                if (f.fast_getuserbyid(testfortest, i) != null)
                {
                    if (f.removequat(f.fast_getuserbyid(testfortest, i).copmanyID) == f.removequat(this.com.companyID))
                    {
                        mone_users++;
                    }
                }
            }
            this.usersstslbl.Content += mone_users + "";

            // mone = f.num_of_mone("calls", "callsmone");
            mone = f.faster_getmone(testfortest, "callsmone");
            for (int i = 1; i < mone + 1; i++)
            {
                //if (f.set_call_by_id(i)!=null)
                if (f.fast_callbyid(testfortest, i) != null)
                {
                    //if(f.removequat(f.set_call_by_id(i).serviceid.company.companyID)==f.removequat(this.com.companyID))
                    if (f.removequat(f.fast_callbyid(testfortest, i).serviceid.company.companyID) == f.removequat(this.com.companyID))
                    {
                        //if(f.removequat(f.set_call_by_id(i).issolved)==0)
                        if (f.removequat(f.fast_callbyid(testfortest, i).issolved) == 0)
                        {
                            open_call++;
                        }
                        else
                        {
                            closed_call++;
                            money += f.removequat(f.set_call_by_id(i).serviceid.price);
                        }
                    }
                }
            }


            this.totalcallstslbl.Content  += (closed_call + open_call) + " ";
            this.opencallstslbl.Content   += open_call + "";
            this.closedcallstslbl.Content += closed_call + "";
            this.erencallstslbl.Content   += money + " ₪";
            //mone = f.num_of_mone("services", "moneServices");
            mone = f.faster_getmone(testfortest, "moneServices");
            for (int i = 1; i < mone + 1; i++)
            {
                //if(f.return_service_by_id(i)!=null)
                if (f.fast_servicebyid(testfortest, i) != null)
                {
                    //if(f.removequat(f.return_service_by_id(i).company.companyID)==f.removequat(this.com.companyID))
                    if (f.removequat(f.fast_servicebyid(testfortest, i).company.companyID) == f.removequat(this.com.companyID))
                    {
                        services_counter++;
                    }
                }
            }


            this.servicestslbl.Content += services_counter + "";
        }