예제 #1
0
        private void btnDown_Click(object sender, EventArgs e)
        {
            btnDown.Enabled = false;
            if (chbUsers.SelectedIndex == chbUsers.Items.Count - 1)
            {
                return;
            }
            if (chbUsers.SelectedItem != null)
            {
                JKeyValue       VSelect = (JKeyValue)chbUsers.SelectedItem;
                JReferOrderUser RO      = new JReferOrderUser();
                if (RO.Find((int)VSelect.Value))
                {
                    RO.OrderDown((int)VSelect.Value);
                }
                else
                {
                    RO.PostCode     = ClassLibrary.JMainFrame.CurrentPostCode;
                    RO.PostCodeUser = (int)VSelect.Value;
                    RO.Ordered      = 1;
                    RO.Insert();
                }
            }
            int Index = chbUsers.SelectedIndex;

            chbUsers.Items.Insert(Index + 2, chbUsers.SelectedItem);
            chbUsers.Items.RemoveAt(Index);

            chbUsers.SelectedIndex = Index + 1;

            OrderRefresh();
            btnDown.Enabled = true;
        }
예제 #2
0
        private void OrderRefresh()
        {
            JReferOrderUser RO    = new JReferOrderUser();
            int             count = 1;

            for (int i = 0; i < chbUsers.Items.Count; i++)
            {
                JKeyValue KV = (JKeyValue)chbUsers.Items[i];
                if (RO.Find((int)KV.Value, true))
                {
                    RO.Ordered = count++;
                    RO.Update();
                }
                else
                {
                    RO.PostCode     = ClassLibrary.JMainFrame.CurrentPostCode;
                    RO.PostCodeUser = (int)KV.Value;
                    RO.Ordered      = count++;
                    RO.Insert();
                }
            }
        }
예제 #3
0
        private void cmbNextNodes_SelectedIndexChanged(object sender, EventArgs e)
        {
            JWorkFlow NextNode = (JWorkFlow)cmbNextNodes.SelectedItem;
            DataTable DT       = NextNode.GetPosts();

            if (DT == null)
            {
                return;
            }
            DataColumn DC = new DataColumn("OrderedPosts", typeof(int));

            DT.Columns.Add(DC);
            JReferOrderUser RO    = new JReferOrderUser();
            int             Count = 0;

            foreach (DataRow DR in DT.Rows)
            {
                int i = 0;
                int.TryParse(DR["Code"].ToString().Trim(), out i);
                if (i > 0)
                {
                    try
                    {
                        if (RO.Find(i, true))
                        {
                            DR["OrderedPosts"] = RO.Ordered;
                            Count = RO.Ordered;
                        }
                        else
                        {
                            RO.PostCode     = ClassLibrary.JMainFrame.CurrentPostCode;
                            RO.PostCodeUser = (int)DR["Code"];
                            RO.Ordered      = ++Count;
                            RO.Insert();
                        }
                    }
                    catch
                    {
                    }
                }
            }
            DT.AcceptChanges();

            DataView dv = DT.DefaultView;

            dv.Sort = "OrderedPosts";
            DT      = dv.ToTable();

            try
            {
                DT.Merge(_PostCodes);
            }
            catch
            {
            }

            Tidy(DT, "Full_Title", "Full_Title_Slim", 45);
            chbUsers.Items.Clear();
            foreach (DataRow dr in DT.Rows)
            {
                JKeyValue jKeyValue = new JKeyValue();
                jKeyValue.Value = dr["Code"];
                jKeyValue.Key   = dr["Full_Title_Slim"].ToString();
                chbUsers.Items.Add(jKeyValue);
            }
        }