Exemplo n.º 1
0
        public void saveTaskFields(string result)
        {
            string text  = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result))["IDKey"][0];
            string text2 = "INSERT INTO taskfields (taskfields.Index,taskfields.Value,TaskID) VALUES ";

            for (int i = 0; i < this.Names.Count; i++)
            {
                if (!string.IsNullOrEmpty(this.Names[i].Text))
                {
                    string stripped1 = FormatFunctions.CleanDateNew(Names[i].Text);
                    string stripped2 = FormatFunctions.CleanDateNew(Values[i].Text);
                    text2 = string.Concat(new string[]
                    {
                        text2,
                        "('",
                        stripped1,
                        "', '",
                        stripped2,
                        "', '",
                        text,
                        "'),"
                    });
                }
            }
            text2 = text2 + "('', '', '" + text + "')";
            DatabaseFunctions.SendToPhp(text2);
            Tasks_Page page = new Tasks_Page();

            ClientData.mainFrame.Navigate(page);
        }
Exemplo n.º 2
0
        public void onClickedCreate(object sender, RoutedEventArgs e)
        {
            string sql = "INSERT INTO tasks (Name,AgentID,Start) VALUES ('" + FormatFunctions.CleanDateNew(taskName.Text) + "','" + agent.getSelectID() + "','" + Datepick.Text + ");";

            DatabaseFunctions.SendToPhp(sql);
            DatabaseFunctions.SendToPhp(false, "SELECT IDKey FROM tasks ORDER BY IDKey DESC LIMIT 1;", new TaskCallback(this.saveTaskFields));
        }
 public void onClicked(object sender, RoutedEventArgs e)
 {
     foreach (DataPair dataPair in this.entryDict)
     {
         if (dataPair.isNew)
         {
             DatabaseFunctions.SendToPhp(string.Concat(new object[]
             {
                 "INSERT INTO cusfields (cusfields.Value,cusfields.Index,CusID) VALUES('",
                 FormatFunctions.CleanDateNew(dataPair.Value.Text),
                 "','",
                 FormatFunctions.CleanDateNew(dataPair.Index.Text),
                 "','",
                 this.customer,
                 "')"
             }));
             dataPair.isNew = false;
         }
         else if (dataPair.Index.Text != dataPair.Index.GetInit())
         {
             DatabaseFunctions.SendToPhp(string.Concat(new object[]
             {
                 "UPDATE cusfields SET Value = '",
                 FormatFunctions.CleanDateNew(dataPair.Value.Text),
                 "',Index='",
                 FormatFunctions.CleanDateNew(dataPair.Index.Text),
                 "' WHERE (IDKey= '",
                 dataPair.Index.GetInt(),
                 "');"
             }));
         }
     }
 }
Exemplo n.º 4
0
        public void onClicked(object sender, RoutedEventArgs e)
        {
            List <string> batch = new List <string>();

            foreach (DataPair dataPair in this.entryDict)
            {
                if (dataPair.isNew)
                {
                    string s = "INSERT INTO cusfields (cusfields.Value,cusfields.Index,CusID) VALUES('" + FormatFunctions.CleanDateNew(dataPair.Value.Text) + "','" + FormatFunctions.CleanDateNew(dataPair.Index.Text) + "','" + this.customer + "')";
                    batch.Add(s);
                    dataPair.isNew = false;
                }
                else if (!dataPair.Index.Text.Equals(dataPair.Index.GetInit()) || !dataPair.Value.Text.Equals(dataPair.Value.GetInit()))
                {
                    string s = "UPDATE cusfields SET cusfields.Value = '" + FormatFunctions.CleanDateNew(dataPair.Value.Text) + "',cusfields.Index='" + FormatFunctions.CleanDateNew(dataPair.Index.Text) + "' WHERE (IDKey= '" + dataPair.Index.GetInt() + "');";
                    batch.Add(s);
                }
            }
            string sql = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(noteLabel.Text) + "' WHERE cusfields.Index LIKE'%otes%' AND CusID= '" + customer + "'";

            batch.Add(sql);
            string sql2 = "UPDATE cusindex SET Name='" + FormatFunctions.CleanDateNew(nameLabel.Text) + "' WHERE IDKey= '" + customer + "'";

            batch.Add(sql2);
            string sql3 = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(BookingDate.Text) + "' WHERE cusfields.Index LIKE '%ookin%' AND CusID= '" + customer + "'";

            batch.Add(sql3);
            string sql4 = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanPhone(phoneLabel.Text) + "' WHERE cusfields.Index LIKE '%hone%' AND CusID= '" + customer + "'";

            batch.Add(sql4);
            string sql5 = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "' WHERE cusfields.Index LIKE '%odified On%' AND CusID= '" + customer + "'";//'Modified On','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "'

            batch.Add(sql5);
            DatabaseFunctions.SendBatchToPHP(batch);
        }
Exemplo n.º 5
0
        public void onClicked(object sender, RoutedEventArgs e)
        {
            foreach (DataPair dataPair in entryDict)
            {
                if (dataPair.isNew)
                {
                    DatabaseFunctions.SendToPhp(string.Concat(new object[]
                    {
                        "INSERT INTO cusfields (cusfields.Value,cusfields.Index,CusID) VALUES('",
                        FormatFunctions.CleanDateNew(dataPair.Value.Text),
                        "','",
                        FormatFunctions.CleanDateNew(dataPair.Index.Text),
                        "','",
                        this.customer,
                        "')"
                    }));
                    dataPair.isNew = false;
                }
                else if (!dataPair.Index.Text.Equals(dataPair.Index.GetInit()) || !dataPair.Value.Text.Equals(dataPair.Value.GetInit()))
                {
                    DatabaseFunctions.SendToPhp(string.Concat(new object[] { "UPDATE cusfields SET Value = '", FormatFunctions.CleanDateNew(dataPair.Value.Text), "', Cusfields.Index='", FormatFunctions.CleanDateNew(dataPair.Index.Text), "' WHERE (IDKey= '", dataPair.Index.GetInt(), "');" }));
                }
            }
            string sql = "DELETE FROM cusfields WHERE CusID='" + customer + "' AND cusfields.Index='INVOICEFIELD'";

            DatabaseFunctions.SendToPhp(sql);
            foreach (DataPair dp in entryDictQ)
            {
                if (dp.Value.Text != "" && dp.Index.Text != "")
                {
                    string sql2 = "INSERT INTO cusfields(cusfields.Value,cusfields.Index,CusID,cusfields.AdvValue) VALUES ('" + FormatFunctions.CleanDateNew(dp.Value.Text) + "','INVOICEFIELD','" + customer + "','" + FormatFunctions.CleanDateNew(dp.Index.Text) + "')";
                    DatabaseFunctions.SendToPhp(sql2);
                }
            }

            List <string> batch = new List <string>();
            string        sql5  = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "' WHERE cusfields.Index LIKE '%odified On%' AND CusID= '" + customer + "'";//'Modified On','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "'

            batch.Add(sql5);
            string sql3 = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(contactLabel.Text) + "' WHERE cusfields.Index LIKE '%ookin%' AND CusID= '" + customer + "'";

            batch.Add(sql3);
            string sql4 = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanPhone(phoneLabel.Text) + "' WHERE cusfields.Index LIKE '%hone%' AND CusID= '" + customer + "'";

            batch.Add(sql4);
            string sql6 = "UPDATE cusfields SET cusfields.value='" + salesmen[SalemanCombo.SelectedIndex] + "' WHERE cusfields.Index LIKE '%alesman%' AND CusID= '" + customer + "'";

            batch.Add(sql6);
            string sql7 = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "' WHERE cusfields.Index LIKE '%odified On%' AND CusID= '" + customer + "'";//'Modified On','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "'

            batch.Add(sql7);
            string sql8 = "UPDATE cusindex SET Name='" + FormatFunctions.CleanDateNew(nameLabel.Text) + "' WHERE IDKey='" + customer + "'";

            batch.Add(sql8);
            DatabaseFunctions.SendBatchToPHP(batch);
            Install_Page page = new Install_Page(customer, stage);

            ClientData.mainFrame.Navigate(page);
        }
Exemplo n.º 6
0
        public void onClickOverrideTime(object sender, RoutedEventArgs e)
        {
            DataButton b   = (DataButton)sender;
            string     sql = "UPDATE punchclock SET TimeStamp='" + FormatFunctions.CleanDateNew(Timepick.Text) + "' WHERE IDKey='" + b.GetInt() + "'";

            DatabaseFunctions.SendToPhp(sql);
            b.Background = new SolidColorBrush(Color.FromRgb(213, 213, 213));
        }
Exemplo n.º 7
0
        public void OnClickSendMsg(object sender, EventArgs e)
        {
            int    num  = int.Parse(DatabaseFunctions.lookupInDictionary((string)Target.SelectedItem, "Name", "IDKey", this.pickerIndex));
            int    num2 = int.Parse(DatabaseFunctions.lookupInDictionary((string)Target.SelectedItem, "Name", "g", this.pickerIndex));
            string text = FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d HH:mm:ss"));
            string sql  = "INSERT INTO chat (Message,AgentID,TargetID,Global,Timestamp) VALUES ('" + Message.Text + "','" + ClientData.AgentIDK + "','" + num + "','" + num2 + "','" + text + "')";

            DatabaseFunctions.SendToPhp(sql);
            this.getChatMessages();
        }
Exemplo n.º 8
0
        public void onClickSave(object sender, EventArgs e)
        {
            string        sql   = "UPDATE cusfields SET Value='" + FormatFunctions.CleanDateNew(Address.Text) + "' WHERE Index LIKE '%Address%' AND CusID='" + CusID + "'";
            string        sql2  = "UPDATE cusfields SET Value='" + FormatFunctions.CleanDateNew(Phone.Text) + "' WHERE Index LIKE '%Phone%' AND CusID='" + CusID + "'";
            string        sql3  = "UPDATE cusfields SET Value='" + FormatFunctions.CleanDateNew(Email.Text) + "' WHERE Index LIKE '%Email%' AND CusID='" + CusID + "'";
            string        sql4  = "UPDATE cusfields SET Value='" + FormatFunctions.CleanDateNew(Region.Text) + "' WHERE Index LIKE '%Region%' AND CusID='" + CusID + "'";
            string        sql5  = "UPDATE cusfields SET Value='" + FormatFunctions.CleanDateNew(LastContact.Date.ToString()) + "' WHERE Index LIKE '%Address%' AND CusID='" + CusID + "'";
            string        sql6  = "UPDATE cusindex SET Name='" + Name.Text + "' WHERE IDKey='" + CusID + "'";
            string        sql7  = "UPDATE cusfields SET Value='" + FormatFunctions.CleanDateNew(Source.Text) + "' WHERE Index LIKE '%Source%' AND CusID='" + CusID + "'";
            List <string> batch = new List <string>()
            {
                sql, sql2, sql3, sql4, sql5, sql6
            };

            DatabaseFunctions.SendBatchToPHP(batch);
        }
Exemplo n.º 9
0
        public void onClickSave(object sender, EventArgs e)
        {
            DateTime      x     = Convert.ToDateTime(LastContact.Text);
            string        sql   = "UPDATE cusfields SET cusfields.Value='" + FormatFunctions.CleanDateNew(Address.Text) + "' WHERE cusfields.Index LIKE '%Address%' AND CusID='" + CusID + "'";
            string        sql2  = "UPDATE cusfields SET cusfields.Value='" + FormatFunctions.CleanPhone(Phone.Text) + "' WHERE cusfields.Index LIKE '%Phone%' AND CusID='" + CusID + "'";
            string        sql3  = "UPDATE cusfields SET cusfields.Value='" + FormatFunctions.CleanDateNew(Email.Text) + "' WHERE cusfields.Index LIKE '%Email%' AND CusID='" + CusID + "'";
            string        sql4  = "UPDATE cusfields SET cusfields.Value='" + FormatFunctions.CleanDateNew(Region.Text) + "' WHERE cusfields.Index LIKE '%Region%' AND CusID='" + CusID + "'";
            string        sql5  = "UPDATE cusfields SET cusfields.Value='" + FormatFunctions.CleanDateNew(x.ToString("yyyy/M/d h:mm:ss")) + "' WHERE cusfields.Index LIKE '%ast Contac%' AND CusID='" + CusID + "'";
            string        sql6  = "UPDATE cusindex SET Name='" + FormatFunctions.CleanDateNew(NameEntry.Text) + "' WHERE IDKey='" + CusID + "'";
            string        sql7  = "UPDATE cusfields SET cusfields.Value='" + FormatFunctions.CleanDateNew(Source.Text) + "' WHERE cusfields.Index LIKE '%Source%' AND CusID='" + CusID + "'";
            string        sql8  = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "' WHERE cusfields.Index LIKE '%odified On%' AND CusID= '" + CusID + "'";//'Modified On','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "'
            string        sql9  = "UPDATE cusfields SET cusfields.Value='" + FormatFunctions.CleanDateNew(Postal.Text) + "' WHERE cusfields.Index LIKE '%Postal%' AND CusID='" + CusID + "'";
            List <string> batch = new List <string>()
            {
                sql, sql2, sql3, sql4, sql5, sql6, sql7, sql8, sql9
            };

            DatabaseFunctions.SendBatchToPHP(batch);
        }
Exemplo n.º 10
0
        //TODO Add Populate File list here
        public void onClicked(object sender, EventArgs e)
        {
            List <string> batch = new List <string>();

            foreach (DataPair dataPair in this.entryDict)
            {
                if (dataPair.isNew)
                {
                    DatabaseFunctions.SendToPhp(string.Concat(new object[]
                    {
                        "INSERT INTO cusfields (cusfields.Value,cusfields.Index,CusID) VALUES('",
                        dataPair.Value.Text,
                        "','",
                        dataPair.Index.Text,
                        "','",
                        this.customer,
                        "')"
                    }));
                    dataPair.isNew = false;
                }
                else if (dataPair.Index.Text != dataPair.Index.GetInit() || dataPair.Value.Text != dataPair.Value.GetInit())
                {
                    DatabaseFunctions.SendToPhp(string.Concat(new object[] { "UPDATE cusfields SET Value = '", dataPair.Value.Text, "',Index='", dataPair.Index.Text, "' WHERE (IDKey= '", dataPair.Index.GetInt(), "');" }));
                }
            }
            string sql = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(noteLabel.Text) + "' WHERE cusfields.Index LIKE'%otes%' AND CusID= '" + customer + "'";

            batch.Add(sql);
            string sql2 = "UPDATE cusindex SET Name='" + FormatFunctions.CleanDateNew(nameLabel.Text) + "' WHERE IDKey= '" + customer + "'";

            batch.Add(sql2);
            string sql3 = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(addressLabel.Text) + "' WHERE cusfields.Index LIKE '%dress%' AND CusID= '" + customer + "'";

            batch.Add(sql3);
            string sql4 = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(phoneLabel.Text) + "' WHERE cusfields.Index LIKE '%hone%' AND CusID= '" + customer + "'";

            batch.Add(sql4);
            string sql5 = "UPDATE cusfields SET cusfields.value='" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "' WHERE cusfields.Index LIKE '%odified On%' AND CusID= '" + customer + "'";//'Modified On','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "'

            batch.Add(sql5);
            DatabaseFunctions.SendBatchToPHP(batch);
        }
Exemplo n.º 11
0
        public void saveTemplateFields(string result)
        {
            string text  = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result))["IDKey"][0];
            string text2 = "INSERT INTO taskfields (taskfields.Index,taskfields.Value,TemplateID) VALUES ";
            int    ID    = highestTID + 1;

            for (int i = 0; i < this.Names.Count; i++)
            {
                if (!string.IsNullOrEmpty(this.Names[i].Text))
                {
                    string stripped1 = FormatFunctions.CleanDateNew(Names[i].Text);
                    string stripped2 = FormatFunctions.CleanDateNew(Values[i].Text);
                    text2 = text2 + "('" + stripped1 + "', '" + stripped2 + "', '" + ID + "'),";
                }
            }
            text2 = text2 + "('', '', '" + ID + "')";
            DatabaseFunctions.SendToPhp(text2);
            Tasks_Page page = new Tasks_Page();

            ClientData.mainFrame.Navigate(page);
        }
Exemplo n.º 12
0
        public void populateFields(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            this.entryDict = new List <DataPair>();
            if (dictionary.Count > 0)
            {
                for (int i = 0; i < dictionary["Index"].Count; i++)
                {
                    DataPair dataPair = new DataPair(int.Parse(dictionary["IDKey"][i]), FormatFunctions.CleanDateNew(dictionary["Value"][i]), FormatFunctions.CleanDateNew(dictionary["Index"][i]));
                    dataPair.Value.Text    = FormatFunctions.CleanDateNew(dictionary["Value"][i]);
                    dataPair.Value.ToolTip = "Value here";
                    dataPair.Index.Text    = FormatFunctions.CleanDateNew(dictionary["Index"][i]);
                    dataPair.Index.ToolTip = "Index here";
                    this.entryDict.Add(dataPair);

                    List <UIElement> list = new List <UIElement>();
                    list.Add(dataPair.Value);
                    list.Add(dataPair.Index);
                    GridFiller.rapidFillPremadeObjects(list, TSection, new bool[] { true, true });
                }
            }
        }
Exemplo n.º 13
0
        public void onCreateStageSpecificData(string cusID)
        {
            List <string> batch   = new List <string>();
            string        noteSQL = "INSERT INTO jobfields (cusfields.Index,cusfields.Value,CusID) VALUES ('Notes:','','" + cusID + "'),('Created On','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "','" + cusID + "'),('Modified On','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss")) + "','" + cusID + "')";//'"+ClientData.AgentIDK+"','"+FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d h:mm:ss"))+"'

            batch.Add(noteSQL);
            string sql2 = "INSERT INTO cusfields (cusfields.Index,cusfields.Value,CusID) VALUES ('PhoneNumber','','" + cusID + "')";

            batch.Add(sql2);
            if (NewPicker.SelectedIndex == 0)//For creating leads
            {
                //BookingDate, Notes
                string sql = "INSERT INTO jobfields (cusfields.Index,cusfields.Value,CusID) VALUES ('BookingDate','','" + cusID + "')";
                batch.Add(sql);
            }
            else if (NewPicker.SelectedIndex == 1)//Booked!
            {
                string sql = "INSERT INTO jobfields (cusfields.Index,cusfields.Value,CusID) VALUES ('BookingDate','','" + cusID + "'),('Salesman','','" + cusID + "')";
                batch.Add(sql);
            }
            else if (NewPicker.SelectedIndex == 2)//Quoted!
            {
                string sql = "INSERT INTO jobfields (cusfields.Index,cusfields.Value,CusID) VALUES ('BookingDate','','" + cusID + "'),('Salesman','','" + cusID + "'),('QuoteTotal','','" + cusID + "'),('Signature','False','" + cusID + "'),('Deposit Received','False','" + cusID + "'),('Payment Method','Fill Me Out!','" + cusID + "')";
                batch.Add(sql);
            }
            else if (NewPicker.SelectedIndex == 3)//Followup on Quote
            {
                string sql = "INSERT INTO jobfields (cusfields.Index,cusfields.Value,CusID) VALUES ('BookingDate','','" + cusID + "'),('Salesman','','" + cusID + "'),('QuoteTotal','','" + cusID + "'),('Signature','False','" + cusID + "'),('Deposit Received','False','" + cusID + "'),('Payment Method','Fill Me Out!','" + cusID + "'),('LastContact','mm/dd','" + cusID + "')";
                batch.Add(sql);
            }
            else if (NewPicker.SelectedIndex == 4)//Sold!
            {
                string sql = "INSERT INTO jobfields (cusfields.Index,cusfields.Value,CusID) VALUES ('BookingDate','','" + cusID + "'),('Salesman','','" + cusID + "'),('QuoteTotal','','" + cusID + "'),('Signature','True','" + cusID + "'),('Deposit Received','True','" + cusID + "'),('Payment Method','Fill Me Out!','" + cusID + "')";

                batch.Add(sql);
            }
            else if (NewPicker.SelectedIndex == 5)//Install!
            {
                string sql = "INSERT INTO jobfields (cusfields.Index,cusfields.Value,CusID) VALUES ('Salesman','','" + cusID + "'),('QuoteTotal','','" + cusID + "'),('Signature','True','" + cusID + "'),('Deposit Received','True','" + cusID + "'),('Payment Method','Fill Me Out!','" + cusID + "'),('InstallDate','','" + cusID + "')";
                batch.Add(sql);
            }
            DatabaseFunctions.SendBatchToPHP(batch);
        }
Exemplo n.º 14
0
        public void writeState(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            if (dictionary.Count > 0)
            {
                PunchedIn = bool.Parse(dictionary["State"][0]);
                if (((PunchedIn && !createPunchOnResult) || (!PunchedIn && createPunchOnResult)) && !statelessPunch)
                {
                    PunchButton.Background = new SolidColorBrush(ClientData.rotatingConfirmationColors[0]);
                    ClockState.Content     = "Current State: Clocked In";
                }
                else if (!statelessPunch)
                {
                    PunchButton.Background = new SolidColorBrush(ClientData.rotatingNegativeColors[0]);
                    ClockState.Content     = "Current State: Clocked Out";
                }
            }
            if (createPunchOnResult)
            {
                createPunchOnResult = false;
                string sql = "INSERT INTO punchclock (AgentID,Timestamp,Coordinates,State,Note) VALUES('" + ClientData.AgentIDK + "','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d HH:mm:ss")) + "','Desktop','" + !PunchedIn + "','" + TextEntry.Text + "')";
                DatabaseFunctions.SendToPhp(sql);
            }
            if (statelessPunch)
            {
                statelessPunch = false;
                string sql = "INSERT INTO punchclock (AgentID,Timestamp,Coordinates,State,Note) VALUES('" + ClientData.AgentIDK + "','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d HH:mm:ss")) + "','Desktop','less','" + TextEntry.Text + "')";
                DatabaseFunctions.SendToPhp(sql);
            }
            getPunches();
        }
Exemplo n.º 15
0
        public async void writeState(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            if (dictionary.Count > 0)
            {
                PunchedIn = bool.Parse(dictionary["State"][0]);
                if (((PunchedIn && !createPunchOnResult) || (!PunchedIn && createPunchOnResult)) && !statelessPunch)
                {
                    ClockState.Text = "Current State: Clocked In";
                }
                else if (!statelessPunch)
                {
                    ClockState.Text = "Current State: Clocked Out";
                }
            }
            if (createPunchOnResult)
            {
                createPunchOnResult = false;
                var      request  = new GeolocationRequest(GeolocationAccuracy.Medium);
                Location location = await Geolocation.GetLocationAsync(request);

                var placemark = await Geocoding.GetPlacemarksAsync(location.Latitude, location.Longitude);

                var    x   = placemark?.FirstOrDefault();
                string sql = "INSERT INTO punchclock (AgentID,Timestamp,Coordinates,State,Note) VALUES('" + ClientData.AgentIDK + "','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d HH:mm:ss")) + "','" + x.SubLocality + "< " + x.SubThoroughfare + x.Thoroughfare + "< " + x.PostalCode + "','" + !PunchedIn + "','" + FormatFunctions.CleanDateNew(TextEntry.Text) + "')";
                DatabaseFunctions.SendToPhp(sql);
            }
            if (statelessPunch)
            {
                statelessPunch = false;
                var request  = new GeolocationRequest(GeolocationAccuracy.Medium);
                var location = await Geolocation.GetLocationAsync(request);

                var placemark = await Geocoding.GetPlacemarksAsync(location.Latitude, location.Longitude);

                var    x   = placemark?.FirstOrDefault();
                string sql = "INSERT INTO punchclock (AgentID,Timestamp,Coordinates,State,Note) VALUES('" + ClientData.AgentIDK + "','" + FormatFunctions.CleanDateNew(DateTime.Now.ToString("yyyy/M/d HH:mm:ss")) + "','" + x.SubLocality + "< " + x.SubThoroughfare + x.Thoroughfare + "< " + x.PostalCode + "','less','" + FormatFunctions.CleanDateNew(TextEntry.Text) + "')";
                DatabaseFunctions.SendToPhp(sql);
            }
            getPunches();
        }
Exemplo n.º 16
0
        public void onClickSave(object sender, EventArgs e)
        {
            foreach (DataPair dataPair in this.dp)
            {
                if (dataPair.isNew)
                {
                    string sql = "INSERT INTO jobfields (jobfields.Value,jobfields.Index,JobID) VALUES('" + FormatFunctions.CleanDateNew(dataPair.Value.Text) + "','" + FormatFunctions.CleanDateNew(dataPair.Index.Text) + "','" + this.JobID + "')";
                    DatabaseFunctions.SendToPhp(sql);
                    dataPair.isNew = false;
                }
                else if (dataPair.Index.Text != dataPair.Index.GetInit() || dataPair.Value.Text != dataPair.Value.GetInit())
                {
                    DatabaseFunctions.SendToPhp(string.Concat(new object[] { "UPDATE jobfields SET jobfields.Value = '", FormatFunctions.CleanDateNew(dataPair.Value.Text), "',jobfields.Index='", FormatFunctions.CleanDateNew(dataPair.Index.Text), "' WHERE (IDKey= '", dataPair.Index.GetInt(), "');" }));
                }
            }
            string nsql = "UPDATE jobindex SET Name='" + NameBox.Text + "' WHERE IDKey='" + JobID + "'";

            DatabaseFunctions.SendToPhp(nsql);
        }
Exemplo n.º 17
0
 public void onClicked(object sender, RoutedEventArgs e)
 {
     foreach (DataPair dataPair in this.entryDict)
     {
         if (dataPair.isNew)
         {
             DatabaseFunctions.SendToPhp(
                 "INSERT INTO taskfields (taskfields.Value,taskfields.Index,TaskID) VALUES('" + FormatFunctions.CleanDateNew(dataPair.Value.Text) + "','" + FormatFunctions.CleanDateNew(dataPair.Index.Text) + "','" + this.task + "')");
             dataPair.isNew = false;
         }
         else if (dataPair.Index.Text != dataPair.Index.GetInit() || dataPair.Value.Text != dataPair.Value.GetInit())
         {
             DatabaseFunctions.SendToPhp("UPDATE taskfields SET taskfields.Value = '" + FormatFunctions.CleanDateNew(dataPair.Value.Text) + "', taskfields.Index='" + FormatFunctions.CleanDateNew(dataPair.Index.Text) + "' WHERE (IDKey= '" + dataPair.Index.GetInt() + "');");
         }
     }
 }