Beispiel #1
0
        static public string GenerateNewHash()
        {
            if (DateTime.Now.Subtract(LgenDate).TotalMinutes <= 30 && LastHash != string.Empty)
            {
                return(LastHash);
            }

            LastHash = string.Empty;
            try
            {
                string resultDataAuth = Pman.Get("Auth/?username="******"&password="******"GET", string.Empty);

                Classes.Result resAuth = Classes.Result.Parse(resultDataAuth);
                /* si hay un error, corto */
                if (resAuth.status != "0")
                {
                    OnError(EventArgs.Empty, resAuth.status + " - " + resAuth.message);
                    return(string.Empty);
                }
                LastHash = resAuth.data;
                LgenDate = DateTime.Now;
                return(resAuth.data);
            }
            catch { }
            return(string.Empty);
        }
Beispiel #2
0
        private void La_Delete(object sender, EventArgs e)
        {
            if (MessageBox.Show("Desea eliminar el articulo ?", "Achtung", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                GCMSTests.Classes.Item it = (GCMSTests.Classes.Item)sender;
                string h = Pman.GenerateNewHash();


                string getResult = Pman.Get("Product/" + it.Id.ToString() + "?hash=" + h, "DELETE", null);
                Loader.Controls.Clear();
            }
        }
Beispiel #3
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            this.ConnectionHash = string.Empty;
            this.Url            = tbUrl.Text;
            this.Username       = tUsername.Text;
            this.Password       = tPassword.Text;

            GCMSTests.Pman.Error += Pman_Error;
            string hash = Pman.Connect(this.Url, this.Username, this.Password);

            if (!string.IsNullOrEmpty(hash))
            {
                this.DialogResult = DialogResult.OK;
            }
            GCMSTests.Pman.Error -= Pman_Error;
        }