Exemplo n.º 1
0
        private void frmRecieverSelector_Load(object sender, EventArgs e)
        {
            // Add old descriptions
            dtDescription                   = JARefers.GetDescriptionByPostCode(JMainFrame.CurrentPostCode);
            dgrDescription.DataSource       = dtDescription;
            dgrDescription.Columns[0].Width = dgrDescription.Width * 80 / 100;
            dgrDescription.Columns[1].Width = dgrDescription.Width * 20 / 100;
            // --------------------
            int _ReferCode = 0;

            _workFlowCode = 0;
            if (_ParentRefer > 0)
            {
                JARefer Refer = new JARefer(_ParentRefer);
                _workFlowCode = Refer.WorkFlowCode;
                _ReferCode    = Refer.Code;
            }
            else
            {
                tabControl1.TabPages.RemoveAt(1);
            }
            JWorkFlow WorkFlow = new JWorkFlow(_PublicDataRow, _ReferCode);

            WorkFlow.GetData(_workFlowCode, _ClassName, _DynamicClassName);

            if (WorkFlow.NodeType == JNodeType.PreviousEmployment)
            {
                JARefer _R = new JARefer(_ParentRefer);
                _R.GetData(_R.parent_code);
                if (_R.parent_code != 0)
                {
                    _R.GetData(_R.parent_code);
                    WorkFlow.GetData(_R.WorkFlowCode, "", 0);
                }
                else
                {
                    WorkFlow.GetFirst();
                }
            }

            JWorkFlow[] NextNodes = WorkFlow.GetNextNodes();
            if (NextNodes == null)
            {
                JMessages.Error(" مرحله بعدی برای این وضعیت تعریف نشده است ", "");
            }
            else
            {
                cmbNextNodes.Items.AddRange(NextNodes);
            }

            if (cmbNextNodes.Items.Count > 0)
            {
                cmbNextNodes.SelectedIndex = 0;
            }
        }
Exemplo n.º 2
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);
            }
        }