示例#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);
        }
示例#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();
            }
        }