Пример #1
0
        void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            DataClassesDataContext db = new DataClassesDataContext();
            var   id        = from mytable in db.GetTable <mytable>() select mytable.id;
            var   firstName = from mytable in db.GetTable <mytable>() select mytable.first_name;
            var   lastName  = from mytable in db.GetTable <mytable>() select mytable.last_name;
            var   del       = from mytable in db.GetTable <mytable>() select mytable.phone_number;
            var   del2      = from mytable in db.GetTable <mytable>() select mytable.phone_number2;
            var   dp        = from mytable in db.GetTable <mytable>() select mytable.displayed;
            Array fnlist    = firstName.ToArray();
            Array idlist    = id.ToArray();
            Array lnlist    = lastName.ToArray();
            Array dellits   = del.ToArray();
            Array dplist    = dp.ToArray();
            Array del2list  = null;

            if (del2 != null)
            {
                del2list = del2.ToArray();
            }
            Dispatcher.BeginInvoke(new Action(() =>
            {
                if (del2 == null)
                {
                    for (int i = 0; i < lnlist.Length; i++)
                    {
                        if ((int)dplist.GetValue(i) != 1)
                        {
                            listItem item = new listItem(fnlist.GetValue(i).ToString(), lnlist.GetValue(i).ToString(), dellits.GetValue(i).ToString(), fnlist.GetValue(i).ToString().Trim() + "_" + lnlist.GetValue(i).ToString().Trim());
                            this.lvTest.Items.Add(item);
                            db.ExecuteCommand("UPDATE mytable SET displayed = 1 WHERE id = " + idlist.GetValue(i).ToString());
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < dplist.Length; i++)
                    {
                        if ((int)dplist.GetValue(i) != 1)
                        {
                            listItem item = new listItem(fnlist.GetValue(i).ToString(), lnlist.GetValue(i).ToString(), dellits.GetValue(i).ToString(), fnlist.GetValue(i).ToString().Trim() + "_" + lnlist.GetValue(i).ToString().Trim());
                            this.lvTest.Items.Add(item);
                            db.ExecuteCommand("UPDATE mytable SET displayed = 1 WHERE id = " + idlist.GetValue(i).ToString());
                        }
                    }
                }
            }));
        }
Пример #2
0
        public detail(string funcname)
        {
            InitializeComponent();
            DataClassesDataContext db = new DataClassesDataContext();
            string fn = "", ln = "";

            string[] fl = funcname.Split(new Char[] { '_' });
            fn         = fl[0];
            ln         = fl[1];
            fname.Text = fn;
            lname.Text = ln;
            var   nickname = from mytable in db.GetTable <mytable>() where mytable.first_name == fn && mytable.last_name == ln select mytable.nick_name;
            Array nn    = nickname.ToArray();

            if (nn.GetValue(0) != null)
            {
                nname.Text = nn.GetValue(0).ToString();
            }
            else
            {
                nname.Text = "null";
            }


            var   delt = from mytable in db.GetTable <mytable>() where mytable.first_name == fn && mytable.last_name == ln select mytable.phone_number;
            Array dd   = delt.ToArray();

            if (dd.GetValue(0) != null)
            {
                del.Text = dd.GetValue(0).ToString();
            }
            else
            {
                del.Text = "null";
            }

            var   delt2 = from mytable in db.GetTable <mytable>() where mytable.first_name == fn && mytable.last_name == ln select mytable.phone_number2;
            Array dd2   = delt2.ToArray();

            if (dd2.GetValue(0) != null)
            {
                del2.Text = dd2.GetValue(0).ToString();
            }
            else
            {
                del2.Text = "null";
            }

            var   emailt = from mytable in db.GetTable <mytable>() where mytable.first_name == fn && mytable.last_name == ln select mytable.email;
            Array ee     = emailt.ToArray();

            if (ee.GetValue(0) != null)
            {
                email.Text = ee.GetValue(0).ToString();
            }
            else
            {
                email.Text = "null";
            }
            var   addresst = from mytable in db.GetTable <mytable>() where mytable.first_name == fn && mytable.last_name == ln select mytable.adress;
            Array aa       = addresst.ToArray();

            if (aa.GetValue(0) != null)
            {
                address.Text = aa.GetValue(0).ToString();
            }
            else
            {
                address.Text = "null";
            }
            var   describet = from mytable in db.GetTable <mytable>() where mytable.first_name == fn && mytable.last_name == ln select mytable.describe;
            Array dds       = describet.ToArray();

            if (dds.GetValue(0) != null)
            {
                describe.Text = dds.GetValue(0).ToString();
            }
            else
            {
                describe.Text = "null";
            }
        }