Ejemplo n.º 1
0
        public void populateGrid(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            if (dictionary.Count > 0)
            {
                string   filepath         = dictionary["Value"][0] + " - " + dictionary["Name"][0];
                string[] customerFileList = DatabaseFunctions.getCustomerFileList(filepath);
                filepath.Replace(" ", "%20");
                foreach (string text in customerFileList)
                {
                    if ((text != "." || text != "..") && customerFileList.Length > 1)
                    {
                        SecurityButton dataButton = new SecurityButton(text, new string[] { "Sales" })
                        {
                            Text     = text,
                            String2  = filepath,
                            FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
                        };
                        dataButton.Clicked += onFileButton;
                        List <View> list = new List <View>()
                        {
                            dataButton
                        };
                        GridFiller.rapidFillPremadeObjects(list, this, new bool[] { false });
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static string[] getCustomerFileList(string name)
        {
            string s = JsonClass.JSONSerialize <DatabaseFunctions.data>(new DatabaseFunctions.data
            {
                df_text1 = name
            });
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://174.114.166.80/getCusFolders.php");

            httpWebRequest.Method = "POST";
            byte[] bytes = Encoding.UTF8.GetBytes(s);
            httpWebRequest.ContentType   = "application/x-www-form-urlencoded";
            httpWebRequest.ContentLength = (long)bytes.Length;
            Stream requestStream = httpWebRequest.GetRequestStream();

            requestStream.Write(bytes, 0, bytes.Length);
            WebResponse  response       = httpWebRequest.GetResponse();
            Stream       responseStream = response.GetResponseStream();
            StreamReader streamReader   = new StreamReader(responseStream);

            string[] result = FormatFunctions.SplitToPairs(streamReader.ReadToEnd());
            httpWebRequest.Abort();
            streamReader.Close();
            responseStream.Close();
            response.Close();
            requestStream.Close();
            return(result);
        }
Ejemplo n.º 3
0
        public void loadRoles(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            Roles = new List <string>();
            if (dictionary.Count > 0)
            {
                Roles = dictionary["AgentRole"];
            }
        }
Ejemplo n.º 4
0
        public void loadSecurityKeys(string result)
        {
            Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result));

            SecurityKeys = new List <string>();
            if (dictionary.Count > 0)
            {
                SecurityKeys = dictionary["PermissionGranted"];
            }
        }
Ejemplo n.º 5
0
 public void response(string result)
 {
     string[] input = FormatFunctions.SplitToPairs(result);
     dict      = FormatFunctions.createValuePairs(input);
     Responded = true;
     if (dict.Count > 1)
     {
         ClientData.AgentIDK = int.Parse(dict["IDKey"][0]);
         string       sql  = "SELECT PermissionGranted FROM agentpermissions WHERE AgentID='" + AgentIDK + "'";
         TaskCallback call = loadSecurityKeys;
         DatabaseFunctions.SendToPhp(false, sql, call);
         string       sql2  = "SELECT AgentRole FROM agentroles WHERE AgentID='" + AgentIDK + "'";
         TaskCallback call2 = loadRoles;
         DatabaseFunctions.SendToPhp(false, sql2, call2);
     }
 }
Ejemplo n.º 6
0
        public static string getCallFile(string Date, string filename, TaskCallback call)
        {
            string[] array   = FormatFunctions.CleanDate(Date);
            string   df_text = string.Concat(new string[]
            {
                @"CDR\",
                array[0],
                @"\",
                array[1],
                @"\",
                array[2],
                @"\",
                filename
            });
            string s = JsonClass.JSONSerialize <DatabaseFunctions.data>(new DatabaseFunctions.data
            {
                df_text1 = df_text
            });

            byte[]         bytes          = Encoding.UTF8.GetBytes(s);
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://174.114.166.80/getCusFile.php");

            httpWebRequest.Method        = "POST";
            httpWebRequest.ContentType   = "application/x-www-form-urlencoded";
            httpWebRequest.ContentLength = (long)bytes.Length;
            httpWebRequest.GetRequestStream().Write(bytes, 0, bytes.Length);
            Stream responseStream = ((HttpWebResponse)httpWebRequest.GetResponse()).GetResponseStream();
            int    num            = 1024;

            byte[]     buffer     = new byte[num];
            string     path       = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            FileStream fileStream = File.Create(path + "CHStreamFile" + filename);
            int        count;

            while ((count = responseStream.Read(buffer, 0, num)) != 0)
            {
                fileStream.Write(buffer, 0, count);
            }
            httpWebRequest.Abort();
            return("CHStreamFile" + filename);
        }
Ejemplo n.º 7
0
 public static void boolSetter(string result)
 {
     string[] input = FormatFunctions.SplitToPairs(result);
     dict      = FormatFunctions.createValuePairs(input);
     Responded = true;
 }