Ejemplo n.º 1
0
        public JAFolder[] GetMainFolders(int pFolderType)
        {
            JDataBase DB = new JDataBase();

            try
            {
                DB.setQuery("SELECT * FROM " + ClassLibrary.JTableNamesAutomation.Folders + " WHERE user_post_code=" + JMainFrame.CurrentPostCode.ToString()
                            + " AND foldertype = " + pFolderType.ToString() + " AND (" + Folder.parent_code + "<1 OR " + Folder.parent_code + " IS NULL)");
                DB.Query_DataReader();
                JAFolder[] Folders = new JAFolder[0];
                Array.Resize(ref Folders, DB.RecordCount);
                int count = 0;
                while (DB.DataReader.Read())
                {
                    JAFolder folder = new JAFolder();
                    JTable.SetToClassProperty(folder, DB.DataReader);
                    Folders[count++] = folder;
                }
                return(Folders);
            }
            finally
            {
                DB.Dispose();
            }
        }
Ejemplo n.º 2
0
        private void Set_form()
        {
            cmbPosts.DisplayMember = "Full_Title_Slim";
            cmbPosts.ValueMember   = "code";
            DataTable _dt = (new Employment.JEOrganizationChart()).GetParents(JMainFrame.CurrentPostCode);

            (_dt as JDataTable).Tidy("Full_Title", "Full_Title_Slim", 38);
            cmbPosts.DataSource = _dt;

            cmbObject.DisplayMember = "Text";
            cmbObject.ValueMember   = "Code";
            cmbObject.DataSource    = JObjects.GetDistinctObjects();



            if (_Code != 0)
            {
                JAFolder tmpFolder = new JAFolder();
                tmpFolder.GetData(_Code);
                txtKartablName.Text     = tmpFolder.Name;
                txtObjectType.Text      = tmpFolder.Subject;
                cmbPosts.SelectedValue  = tmpFolder.Sender_User_post_code;
                cmbObject.SelectedValue = tmpFolder.Object_type;
            }
        }
Ejemplo n.º 3
0
        private void FillTree()
        {
            JAFolder  tmpJKartabl = new JAFolder();
            DataTable dt          = new DataTable();

            dt = tmpJKartabl.GetKartablCondition(JMainFrame.CurrentPostCode);
            if (dt != null)
            {
                DataRow dr;
                dr               = dt.NewRow();
                dr["ID"]         = "-1";
                dr["full_title"] = "کارتابل";
                //dr["parentcode"] = "";
                dt.Rows.InsertAt(dr, 0);

                jDataTreeView1.dtTree     = dt.Copy();
                jDataTreeView1.Title      = "full_title";
                jDataTreeView1.Code       = "ID";
                jDataTreeView1.ParentCode = "parentcode";
                jDataTreeView1.CheckBox   = false;
                jDataTreeView1.CMenu      = null;
                jDataTreeView1.Refresh();
                jDataTreeView1.TreeView.ImageList  = JImageIcon.GetImageList(new System.Drawing.Size(24, 24));
                jDataTreeView1.TreeView.ImageIndex = (int)JImageIndex.mail_48;
            }
        }
Ejemplo n.º 4
0
        public void GetFolderRefer(int pFolderCode)
        {
            JAFolder Folder = new JAFolder(pFolderCode);

            if (Folder.FolderType == JAFolderTypeEnum.Inbox.GetHashCode())
            {
                GetInBoxRefer(pFolderCode);
            }
            if (Folder.FolderType == JAFolderTypeEnum.SendItem.GetHashCode())
            {
                GetReferSend(pFolderCode);
            }
        }
Ejemplo n.º 5
0
        private void JDefineKartabl_Load(object sender, EventArgs e)
        {
            if (_Code <= 0)
            {
                return;
            }
            JAFolder tmpJKartabl = new JAFolder(_Code);

            txtKartablName.Text           = tmpJKartabl.Name;
            _Parent_code                  = tmpJKartabl.parent_code;
            _Folder_Type                  = tmpJKartabl.FolderType;
            txtObjectType.Text            = tmpJKartabl.Subject;
            chbDeleteFromKaratble.Checked = tmpJKartabl.DeleteFromKartable;
        }
Ejemplo n.º 6
0
        public void MoveToFolder(System.Data.DataRow pDR)
        {
            JFoldersListForm FFL = new JFoldersListForm(CurrentKartable.GetHashCode());

            FFL.ShowDialog();
            if (FFL.DialogResult == System.Windows.Forms.DialogResult.OK && FFL.CodeSelect > -1)
            {
                JReferFolder _Folder = new JReferFolder();
                _Folder.ReferCode       = (int)pDR["Code"];
                _Folder.ReferFolderCode = FFL.CodeSelect;
                _Folder.Insert();
                JAFolder AF = new JAFolder(FFL.CodeSelect);
                if (AF.DeleteFromKartable)
                {
                    Nodes.Delete(Nodes.CurrentNode);
                }
            }
        }
Ejemplo n.º 7
0
        private void TsbDelete_Click(object sender, EventArgs e)
        {
            int i = 0;

            SelectedItem = (DataRow)(((System.Windows.Forms.TreeNode)jDataTreeView1.SelectedItem).Tag);
            JAFolder tmpJKartabls = new JAFolder();

            i = Convert.ToInt32(((System.Data.DataRow)(((System.Windows.Forms.TreeNode)(jDataTreeView1.SelectedItem)).Tag)).ItemArray[0]);
            if (i != -1)
            {
                if (tmpJKartabls.Delete(i))
                {
                    FillTree();
                }
                else
                {
                    JMessages.Message("Delete Not Completed", "Kartabl", JMessageType.Error);
                }
            }
        }
Ejemplo n.º 8
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            JAFolder tmpJKartabl = new JAFolder();
            int      code        = 0;

            tmpJKartabl.Name               = txtKartablName.Text;
            tmpJKartabl.parent_code        = _Parent_code;
            tmpJKartabl.User_post_code     = JMainFrame.CurrentPostCode;
            tmpJKartabl.Create_Date_Time   = JMainFrame.GlobalDataBase.GetCurrentDateTime();
            tmpJKartabl.FolderType         = _Folder_Type;
            tmpJKartabl.Subject            = txtObjectType.Text;
            tmpJKartabl.DeleteFromKartable = chbDeleteFromKaratble.Checked;
            if (cmbPosts.Enabled && cmbPosts.SelectedValue != null)
            {
                tmpJKartabl.Sender_User_post_code = (int)cmbPosts.SelectedValue;
            }
            else
            {
                tmpJKartabl.Sender_User_post_code = 0;
            }

            if (cmbObject.Enabled && cmbObject.SelectedValue != null)
            {
                tmpJKartabl.Object_type = (string)cmbObject.SelectedValue;
            }
            else
            {
                tmpJKartabl.Object_type = "";
            }


            if (State == JFormState.Insert)
            {
                code = tmpJKartabl.Insert();
                if (code > 0)
                {
                    JMessages.Message("Register Successfully", "Kartabl", JMessageType.Information);
                    this.Dispose();
                }
                else
                {
                    JMessages.Message("Register Not Successfully", "Kartabl", JMessageType.Information);
                }
            }
            else if (State == JFormState.Update)
            {
                tmpJKartabl.Code = _Code;
                try
                {
                    if (tmpJKartabl.Update())
                    {
                        JMessages.Message("Update Successfully", "Kartabl", JMessageType.Information);
                        this.Dispose();
                    }
                    else
                    {
                        JMessages.Message("Update Not Successfully", "Kartabl", JMessageType.Information);
                    }
                }
                catch (Exception ex)
                {
                    JSystem.Except.AddException(ex);
                    JMessages.Message("Update Not Successfully", "Kartabl", JMessageType.Information);
                }
            }
        }