Exemplo n.º 1
0
        /// <summary>
        /// Add a customer charge for a customer
        /// </summary>
        /// <param name="customCharge">A CustomerChargePost object with the customer charge and customer code</param>
        /// <returns>A Customer object with the reflected custom charge</returns>
        public async Task <Customer> AddCustomCharge(CustomChargePost customCharge)
        {
            Customers customers    = new Customers();
            Customer  editCustomer = new Customer();

            try
            {
                string urlPath    = $"/customers/set-item-quantity/productCode/{_config.productCode}/code/{customCharge.CustomerCode}/itemCode/{customCharge.ItemCode}";
                string postParams = FormatFunctions.addParam("chargeCode", customCharge.ChargeCode) +
                                    FormatFunctions.addParam("quantity", customCharge.Quantity.ToString()) +
                                    FormatFunctions.addParam("eachAmount", customCharge.EachAmount.ToString()) +
                                    FormatFunctions.addParam("description", customCharge.Description);

                string result = await _httpService.postRequest(urlPath, postParams);

                XDocument newCustomerXML = XDocument.Parse(result);
                customers = getCustomerList(newCustomerXML);

                if (customers.CustomerList.Count > 0)
                {
                    editCustomer = customers.CustomerList[0];
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(editCustomer);
        }
Exemplo n.º 2
0
 public void populateGroups(string result)
 {
     string[] input = FormatFunctions.SplitToPairs(result);
     this.pickerIndex           = FormatFunctions.createValuePairs(input);
     GroupSelector.ItemsSource  = this.pickerIndex["GroupName"];
     GroupSelector.SelectedItem = 1;
 }
Exemplo n.º 3
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]), dictionary["Value"][i], dictionary["Index"][i]);
                    dataPair.Value.Text              = dictionary["Value"][i];
                    dataPair.Value.Placeholder       = "Value here";
                    dataPair.Value.FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
                    dataPair.Value.VerticalOptions   = LayoutOptions.CenterAndExpand;
                    dataPair.Value.HorizontalOptions = LayoutOptions.StartAndExpand;
                    dataPair.Index.Text              = dictionary["Index"][i];
                    dataPair.Index.Placeholder       = "Index here";
                    dataPair.Index.FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
                    dataPair.Index.VerticalOptions   = LayoutOptions.CenterAndExpand;
                    dataPair.Index.HorizontalOptions = LayoutOptions.EndAndExpand;
                    ViewCell    viewCell    = new ViewCell();
                    StackLayout stackLayout = new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal
                    };
                    this.entryDict.Add(dataPair);

                    List <View> list = new List <View>();
                    list.Add(dataPair.Value);
                    list.Add(dataPair.Index);
                    GridFiller.rapidFillPremadeObjects(list, TSection, new bool[] { true, true });
                }
            }
        }
Exemplo n.º 4
0
        public void populateTardiGrid(string result)
        {
            GridFiller.PurgeHeader(TardiGrid);
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));
            int sick  = 0;
            int tardy = 0;

            if (dictionary["IDKey"].Count > 0)
            {
                for (int i = 0; i < dictionary["IDKey"].Count; i++)
                {
                    GridFiller.rapidFill(new string[] { dictionary["RecordType"][i], dictionary["Date"][i], dictionary["Note"][i] }, TardiGrid);
                    if (dictionary["RecordType"][i] == "Sick")
                    {
                        sick++;
                    }
                    else if (dictionary["RecordType"][i] == "Tardy")
                    {
                        tardy++;
                    }
                }
            }
            Sick.Content = "Sick Days: " + sick;
            Late.Content = "Late Days: " + tardy;
        }
Exemplo n.º 5
0
        public void populatePage(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            entryDict        = new List <DataPair>();
            NameDisplay.Text = dictionary["Name"][0];
            if (dictionary.Count > 0)
            {
                for (int i = 0; i < dictionary["Index"].Count; i++)
                {
                    DataPair dataPair = new DataPair(int.Parse(dictionary["FID"][i]), dictionary["value"][i], dictionary["Index"][i]);
                    dataPair.Value.Text              = dictionary["value"][i];
                    dataPair.Value.Placeholder       = "Value here";
                    dataPair.Value.FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
                    dataPair.Value.VerticalOptions   = LayoutOptions.CenterAndExpand;
                    dataPair.Value.HorizontalOptions = LayoutOptions.StartAndExpand;
                    dataPair.Index.Text              = dictionary["Index"][i];
                    dataPair.Index.Placeholder       = "Index here";
                    dataPair.Index.FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
                    dataPair.Index.VerticalOptions   = LayoutOptions.CenterAndExpand;
                    dataPair.Index.HorizontalOptions = LayoutOptions.EndAndExpand;
                    List <View> list = new List <View>()
                    {
                        dataPair.Index, dataPair.Value
                    };
                    int[]  space = new int[] { 2, 2 };
                    bool[] box   = new bool[] { true, true };
                    GridFiller.rapidFillSpacedPremadeObjects(list, mainGrid, space, box);
                    this.entryDict.Add(dataPair);
                }
            }
            this.populateFileList();
        }
Exemplo n.º 6
0
        public void populateList(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            for (int i = 0; i < dictionary["FName"].Count; i++)
            {
                string text = dictionary["FName"][i] ?? "";
                Label  item = new Label
                {
                    Content = (text ?? ""),
                };
                DataSwitch item2 = new DataSwitch(int.Parse(dictionary["IDKey"][i]))
                {
                };
                DataSwitch item3 = new DataSwitch(int.Parse(dictionary["IDKey"][i]))
                {
                };
                List <UIElement> list = new List <UIElement>()
                {
                    item, item2, item3
                };
                GridFiller.rapidFillPremadeObjects(list, TSection, new bool[] { true, true, true });
                Favorites.Add(item2);
                Group.Add(item3);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Update a customer
        /// </summary>
        /// <param name="customer">A CustomerPost object that represents the changes to be updated</param>
        /// <returns>An updated Customer object with the changes applied</returns>
        public async Task <Customer> UpdateCustomer(Customer customer)
        {
            Customers customers       = new Customers();
            Customer  updatedCustomer = new Customer();

            try
            {
                // Create the web request
                string urlPath    = string.Format("/customers/edit-customer/productCode/{0}/code/{1}", _config.productCode, customer.Code);
                string postParams = FormatFunctions.addParam("firstName", customer.FirstName) +
                                    FormatFunctions.addParam("lastName", customer.LastName) +
                                    FormatFunctions.addParam("email", customer.Email) +
                                    FormatFunctions.addParam("company", customer.Company) +
                                    FormatFunctions.addParam("notes", customer.Notes) +
                                    FormatFunctions.addParam("remoteAddress", customer.RemoteAddress) +
                                    FormatFunctions.addMetaDataParams(customer.AdditionalMetaData);

                string result = await _httpService.postRequest(urlPath, postParams);

                XDocument newCustomerXML = XDocument.Parse(result);
                customers = getCustomerList(newCustomerXML);

                if (customers.CustomerList.Count > 0)
                {
                    updatedCustomer = customers.CustomerList[0];
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(updatedCustomer);
        }
Exemplo n.º 8
0
        public void populateResults(string result)
        {
            this.PurgeCells();
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result), true);

            if (dictionary.Count > 1)
            {
                for (int i = 0; i < dictionary["uniqueid"].Count; i++)
                {
                    string         text       = dictionary["calldate"][i] + " : " + FormatFunctions.PrettyPhone(dictionary["cnam"][i]);
                    SecurityButton dataButton = new SecurityButton(int.Parse(Regex.Replace(dictionary["uniqueid"][i], "^[^.]+.", "")), new string[] { "Manager" })
                    {
                        Text              = text,
                        FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        HorizontalOptions = LayoutOptions.EndAndExpand
                    };
                    dataButton.Clicked += onClicked;
                    dataButton.String   = dictionary["calldate"][i];
                    dataButton.String2  = dictionary["recordingfile"][i];
                    List <View> list = new List <View>
                    {
                        dataButton
                    };
                    GridFiller.rapidFillPremadeObjects(list, TSection, new bool[] { true });
                }
            }
        }
Exemplo n.º 9
0
        public void populateList(string result)
        {
            Dictionary <string, List <string> > dictionary  = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));
            Dictionary <string, SecurityButton> dictionary2 = new Dictionary <string, SecurityButton>();

            if (dictionary.Count > 0)
            {
                for (int i = 0; i < dictionary["Name"].Count; i++)
                {
                    if (!dictionary2.ContainsKey(dictionary["IDKey"][i]))
                    {
                        string         text       = FormatFunctions.PrettyDate(dictionary["Name"][i]) + " ," + FormatFunctions.PrettyDate(dictionary["Value"][i]);
                        SecurityButton dataButton = new SecurityButton(int.Parse(dictionary["IDKey"][i]), new string[] { "Employee" })
                        {
                            Content = text,
                            Width   = ClientData.sideFrame.Width * 0.925
                        };
                        dataButton.Click   += this.onClicked;
                        dataButton.Integer2 = int.Parse(dictionary["Stage"][i]);
                        List <UIElement> list = new List <UIElement>()
                        {
                            dataButton
                        };
                        bool[] box = new bool[] { false };
                        GridFiller.rapidFillPremadeObjectsStandardHeight(list, dataGrid, box, 25);
                        dictionary2.Add(dictionary["IDKey"][i], dataButton);
                    }
                    else
                    {
                        SecurityButton dataButton2 = dictionary2[dictionary["IDKey"][i]];
                        dataButton2.Content = dataButton2.Content + " ," + dictionary["Value"][i];
                    }
                }
            }
        }
Exemplo n.º 10
0
        public void populateGrid(string result)
        {
            dp = new List <DataPair>();
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            if (dictionary.Count > 0)
            {
                for (int i = 0; i < dictionary["IDKey"].Count; i++)
                {
                    DataPair         d    = new DataPair(int.Parse(dictionary["IDKey"][i]), dictionary["Index"][i], dictionary["Value"][i]);
                    List <UIElement> list = new List <UIElement>()
                    {
                        d.Index, d.Value
                    };
                    d.Index.Text = FormatFunctions.PrettyDate(dictionary["Index"][i]);
                    if (d.Index.Text.Contains("~"))
                    {
                        d.Value.Text = FormatFunctions.lookupAgentName(int.Parse(dictionary["Value"][i]));
                    }
                    else
                    {
                        d.Value.Text = FormatFunctions.PrettyDate(dictionary["Value"][i]);
                    }
                    GridFiller.rapidFillPremadeObjects(list, bodyGrid, new bool[] { true, true });
                    dp.Add(d);
                }
            }
        }
Exemplo n.º 11
0
        public void populateResults(string result)
        {
            this.PurgeCells();
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result), true);

            if (dictionary.Count > 1)
            {
                for (int i = 0; i < dictionary["uniqueid"].Count; i++)
                {
                    string         text       = dictionary["calldate"][i] + " : " + FormatFunctions.PrettyPhone(dictionary["cnam"][i]);
                    SecurityButton dataButton = new SecurityButton(int.Parse(Regex.Replace(dictionary["uniqueid"][i], "^[^.]+.", "")), new string[] { "Manager" })
                    {
                        Content = text
                    };
                    dataButton.Click  += onClicked;
                    dataButton.String  = dictionary["calldate"][i];
                    dataButton.String2 = dictionary["recordingfile"][i];
                    List <UIElement> list = new List <UIElement>
                    {
                        dataButton
                    };
                    GridFiller.rapidFillPremadeObjects(list, TSection, new bool[] { true });
                }
            }
        }
Exemplo n.º 12
0
        public void populateFields(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            for (int i = 0; i < dictionary["Name"].Count; i++)
            {
                DataEntry item = new DataEntry(int.Parse(dictionary["IDKey"][i]), dictionary["Value"][i])
                {
                    Text              = dictionary["Value"][i],
                    FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.StartAndExpand
                };
                DataEntry item2 = new DataEntry(int.Parse(dictionary["IDKey"][i]), dictionary["Index"][i])
                {
                    Text              = dictionary["Name"][i],
                    FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };
                ViewCell    viewCell    = new ViewCell();
                StackLayout stackLayout = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal
                };
                stackLayout.Children.Add(item2);
                stackLayout.Children.Add(item);
                viewCell.View = stackLayout;
                this.TSection.Add(viewCell);
                this.Values.Add(item);
                this.Names.Add(item2);
            }
        }
Exemplo n.º 13
0
        public void populateStamps(string result)
        {
            GridFiller.PurgeHeader(HourCalcBody);
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));
            List <string> clockin  = new List <string>();
            List <string> clockout = new List <string>();

            if (dictionary.Count > 0)
            {
                for (int i = 0; i < dictionary["IDKey"].Count; i++)
                {
                    string[] y = new string[2];
                    y[0] = FormatFunctions.PrettyDate(dictionary["TimeStamp"][i]);
                    y[1] = convertState(dictionary["State"][i]);
                    if (dictionary["State"][i] == "True")
                    {
                        GridFiller.rapidFillColorized(y, HourCalcBody, true);
                        clockin.Add(FormatFunctions.PrettyDate(dictionary["TimeStamp"][i]));
                    }
                    else if (dictionary["State"][i] == "False")
                    {
                        GridFiller.rapidFillColorized(y, HourCalcBody, false);
                        clockout.Add(FormatFunctions.PrettyDate(dictionary["TimeStamp"][i]));
                    }
                    else
                    {
                        GridFiller.rapidFill(y, HourCalcBody);
                    }
                }
                double x = calculateHours(clockin, clockout) / 60;
                HourDisplay.Text = "Total Hours: " + x;
            }
        }
Exemplo n.º 14
0
        public async void saveTaskFields(string result)
        {
            string text  = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result))["IDKey"][0];
            string text2 = "INSERT INTO taskfields (Index,Value,TaskID) VALUES ";

            for (int i = 0; i < this.Names.Count; i++)
            {
                if (!string.IsNullOrEmpty(this.Names[i].Text))
                {
                    text2 = string.Concat(new string[]
                    {
                        text2,
                        "('",
                        this.Names[i].Text,
                        "', '",
                        this.Values[i].Text,
                        "', '",
                        text,
                        "'),"
                    });
                }
            }
            text2 = text2 + "('', '', '" + text + "')";
            DatabaseFunctions.SendToPhp(text2);
            TaskCallback c = new TaskCallback(this.voidCall);
            await PopupNavigation.Instance.PushAsync(new Notification_Popup("Your Task has been created", "OK", c), true);
        }
Exemplo n.º 15
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.º 16
0
        public void populateList(string result)
        {
            //DatabaseFunctions.SendToDebug("Beginning populating daily tasks");
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            if (dictionary.Count > 1)
            {
                for (int i = 0; i < dictionary["Name"].Count; i++)
                {
                    string         text       = dictionary["Name"][i] ?? "";
                    SecurityButton dataButton = new SecurityButton(int.Parse(dictionary["IDKey"][i]), new string[] { "Employee" })
                    {
                        Text              = text,
                        FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    };
                    dataButton.Clicked += this.onClicked;
                    List <View> list = new List <View>();
                    list.Add(dataButton);
                    GridFiller.rapidFillPremadeObjects(list, tasksList, new bool[] { true, true });
                }
            }
            //DatabaseFunctions.SendToDebug("Finsihed populating daily tasks");
        }
Exemplo n.º 17
0
        public void populatePage(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            entryDict           = new List <DataPair>();
            NameDisplay.Content = FormatFunctions.PrettyDate(dictionary["Name"][0]);
            if (dictionary.Count > 0)
            {
                for (int i = 0; i < dictionary["Index"].Count; i++)
                {
                    DataPair dataPair = new DataPair(int.Parse(dictionary["FID"][i]), dictionary["value"][i], dictionary["Index"][i]);
                    dataPair.Value.Text    = FormatFunctions.PrettyDate(dictionary["value"][i]);
                    dataPair.Value.ToolTip = "Value here";
                    dataPair.Index.Text    = FormatFunctions.PrettyDate(dictionary["Index"][i]);
                    dataPair.Index.ToolTip = "Index here";
                    List <UIElement> list = new List <UIElement>()
                    {
                        dataPair.Index, dataPair.Value
                    };
                    int[]  space = new int[] { 2, 2 };
                    bool[] box   = new bool[] { true, true };
                    GridFiller.rapidFillSpacedPremadeObjects(list, mainGrid, space, box);
                    this.entryDict.Add(dataPair);
                }
            }
            //this.populateFileList();
        }
Exemplo n.º 18
0
        public void populatePunches(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            if (dictionary.Count > 0)
            {
                GridFiller.PurgeGrid(logGrid);
                string[] list = new string[3];
                for (int i = 0; i < dictionary["IDKey"].Count; i++)
                {
                    list[0] = FormatFunctions.PrettyDate(dictionary["Note"][i]);
                    list[2] = FormatFunctions.PrettyDate(dictionary["State"][i]);
                    list[1] = FormatFunctions.PrettyDate(dictionary["TimeStamp"][i]);
                    if (list[2] != "less")
                    {
                        GridFiller.rapidFillColorized(list, logGrid, bool.Parse(list[2]));
                    }
                    else
                    {
                        list[2] = "Location Log";
                        GridFiller.rapidFill(list, logGrid);
                    }
                }
            }
        }
Exemplo n.º 19
0
 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.º 20
0
        public void populateChat(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            if (dictionary.Count > 0)
            {
                for (int i = 0; i < dictionary["Message"].Count; i++)
                {
                    Label item = new Label
                    {
                        Text = string.Concat(new string[]
                        {
                            FormatFunctions.PrettyDate(dictionary["Timestamp"][i]),
                            ":",
                            dictionary["FName"][i],
                            ":",
                            dictionary["Message"][i]
                        }),
                        FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                        VerticalOptions   = LayoutOptions.Start,
                        HorizontalOptions = LayoutOptions.Start
                    };
                    ChatStack.Children.Add(item);
                }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Create a new customer based on the passed in CustomerPost object
        /// </summary>
        /// <param name="customer">A CustomerPost object that represents a customer to be created</param>
        /// <param name="returnUrl">The return url for PayPal transactions</param>
        /// <param name="cancelUrl">The cancel url for PayPal transactions</param>
        /// <returns>A newly created Customer object</returns>
        public async Task <Customer> CreateCustomerWithPayPal(CustomerPost customer, string returnUrl, string cancelUrl)
        {
            Customers customers   = new Customers();
            Customer  newCustomer = new Customer();

            try
            {
                string urlPath    = $"/customers/new/productCode/{_config.productCode}";
                string postParams = "subscription[method]=paypal" +
                                    FormatFunctions.addParam("code", customer.Code) +
                                    FormatFunctions.addParam("firstName", customer.FirstName) +
                                    FormatFunctions.addParam("lastName", customer.LastName) +
                                    FormatFunctions.addParam("email", customer.Email) +
                                    FormatFunctions.addParam("subscription[planCode]", customer.PlanCode) +
                                    FormatFunctions.addParam("subscription[ccFirstName]", customer.CCFirstName) +
                                    FormatFunctions.addParam("subscription[ccLastName]", customer.CCLastName) +
                                    FormatFunctions.addParam("subscription[returnUrl]", returnUrl) +
                                    FormatFunctions.addParam("subscription[cancelUrl]", cancelUrl) +
                                    FormatFunctions.addMetaDataParams(customer.AdditionalMetaData);

                string result = await _httpService.postRequest(urlPath, postParams);

                XDocument newCustomerXML = XDocument.Parse(result);
                customers = getCustomerList(newCustomerXML);
                if (customers.CustomerList.Count > 0)
                {
                    newCustomer = customers.CustomerList[0];
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(newCustomer);
        }
Exemplo n.º 22
0
        public void setupBoxes(string result)
        {
            Labels     = new List <Label>();
            checkBoxes = new List <UIElement>();
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            uniqueIDs   = dictionary["IDKey"];
            uniqueNames = dictionary["FName"];
            foreach (string s in uniqueIDs)
            {//Possible roles are: Sales, Installer
                List <UIElement> elements = new List <UIElement>();
                elements.Add(new Label()
                {
                    Content = s
                });
                elements.Add(new DataDoubleSwitch(int.Parse(s), 0)
                {
                    HorizontalAlignment = HorizontalAlignment.Center
                });                                                                                                   //Sales
                elements.Add(new DataDoubleSwitch(int.Parse(s), 1)
                {
                    HorizontalAlignment = HorizontalAlignment.Center
                });                                                                                                      //Installer
                checkBoxes.AddRange(elements);
                GridFiller.rapidFillPremadeObjects(elements, BodyGrid, new bool[] { true, false, false });
            }
            checkBoxes = FormatFunctions.scrubOutUnlessWanted(checkBoxes, new DataDoubleSwitch(0, 0), Labels);
            for (int j = 0; j < uniqueNames.Count; j++)
            {
                Labels[j].Content = uniqueNames[j];
            }
        }
Exemplo n.º 23
0
        public void populateCombo(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            PriceGuidecombo.ItemsSource = dictionary["v"];
            prices = dictionary["PriceSale"];
        }
Exemplo n.º 24
0
        public void populateSalesCombo(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            SalemanCombo.ItemsSource = dictionary["FName"];
            salesmen = dictionary["IDKey"];
        }
Exemplo n.º 25
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.º 26
0
        public void populateResults(string result)
        {
            this.views = new List <ViewCell>();
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result), true);

            if (dictionary.Count > 1)
            {
                for (int i = 0; i < dictionary["eventtime"].Count; i++)
                {
                    string c;
                    bool   CC = false;
                    if (dictionary["eventtype"][i] == "ANSWER")
                    {
                        c  = "Yes";
                        CC = true;
                    }
                    else
                    {
                        c = "No";
                    }
                    string[] s = new string[3] {
                        FormatFunctions.PrettyPhone(dictionary["cid_num"][i]), dictionary["eventtime"][i], c
                    };
                    GridFiller.rapidFillColorized(s, TSection, CC);
                }
            }
        }
Exemplo n.º 27
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.º 28
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));
        }
Exemplo n.º 29
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.º 30
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));
        }