Esempio n. 1
0
        public async static Task <Level1_Return> Get_Level1_aysnc(string Base, string Key, string Salt, Dictionary <string, object> Claims, Dictionary <string, object> bp)
        {
            var l1 = new Level1_Return();

            if (File.Exists("l1ret.json"))
            {
                using (var sr = new StreamReader("l1ret.json"))
                {
                    string l1d = sr.ReadToEnd();
                    l1 = JsonConvert.DeserializeObject <Level1_Return>(l1d);
                    return(l1);
                }
            }

            Mret m1;
            var  bpl = new Dictionary <string, object>(bp);

            bpl["Call_vector"] = 5000;
            string Token = Enc256.Encode(Key, Salt, Claims);

            m1 = await Get_Data(Base, Token, bpl);

            if (m1.status == 200)
            {
                l1 = JsonConvert.DeserializeObject <Level1_Return>(m1.body);
            }
            else
            {
                l1.code    = m1.status;
                l1.message = m1.message;
            }

            return(l1);
        }
Esempio n. 2
0
        public void Load_Department(Level1_Return l1)
        {
            Department.Enabled = false;
            Department.Items.Clear();
            departments.Clear();
            atdp.Clear();
            for (int i = 0, loopTo = l1.Dpt.Length - 1; i <= loopTo; i++)
            {
                departments[Convert.ToInt32(l1.Dpt[i].departmentid)] = l1.Dpt[i];
            }

            if (departments.Count == 1)
            {
                Department.Visible = false;
                dept_tbox.Visible  = true;
                dept_tbox.Text     = departments[0].name;
            }
            else
            {
                dept_tbox.Visible = false;
            }

            string dfound = "";

            Department.Items.Add(string.Empty);
            foreach (KeyValuePair <int, Dept_Return> k in departments)
            {
                Department.Items.Add(k.Value.name);
                atdp[k.Value.name] = k.Key;
                if (string.IsNullOrEmpty(dfound))
                {
                    dfound = k.Value.name;
                }

                if ((Properties.Settings.Default.department ?? "") == (k.Value.name ?? ""))
                {
                    dfound = k.Value.name;
                }
            }

            if (!((Properties.Settings.Default.department ?? "") == (dfound ?? "")))
            {
                Properties.Settings.Default.department = dfound;
                Properties.Settings.Default.Save();
            }

            Department.SelectedIndex = 0;
            Department.Enabled       = true;
        }
Esempio n. 3
0
        private void Load_providers(Level1_Return l1)
        {
            string          s1;
            string          pphone = null;
            Provider_return p;

            Message_label.Text = "Loading Providers";
            Message_label.Update();
            providers.Clear();
            atpv.Clear();
            for (int i = 0, loopTo = l1.Prv.Count() - 1; i <= loopTo; i++)
            {
                var ad = new StringBuilder();
                providers[l1.Prv[i].Providerid] = l1.Prv[i];
                p  = l1.Prv[i];
                s1 = "";
                if (p.Displayname is object)
                {
                    s1 = p.Displayname;
                }
                else if (p.Firstname is object && p.Lastname is object)
                {
                    s1 = p.Firstname + " " + p.Lastname;
                }

                if (p.Providertype is object && s1.IndexOf(",") == -1 && !s1.EndsWith(p.Providertype))
                {
                    s1 = s1 + ", " + p.Providertype;
                }

                if (p.Homedepartment is object && atdp.ContainsKey(p.Homedepartment))
                {
                    if (departments[atdp[p.Homedepartment]].phone is object)
                    {
                        string args1 = departments[atdp[p.Homedepartment]].phone;
                        pphone = Trimc(ref args1, ")(- ");
                        s1     = s1 + " " + Format_phone(ref pphone);
                    }
                }

                atpv[p.Providerid] = s1;
                prv_combo.Items.Add(s1);
            }

            if (prv_combo.Items.Count > 1)
            {
                priph.Visible     = false;
                prv_combo.Visible = true;
            }
            else
            {
                prv_combo.Visible = false;
                priph.Visible     = true;
            }

            Message_label.Text = null;
            Message_label.Update();
            if (dsaves.Items.Count > 0)
            {
                dsaves.Enabled = true;
            }

            Application.DoEvents();
            return;
        }