Esempio n. 1
0
        /// <summary>
        /// بازیابی لیست آرشیوها
        /// </summary>
        /// <returns></returns>
        public bool LoadDataFromArchive()
        {
            JArchiveDocument archive = new JArchiveDocument(SubjectCode, PlaceCode);

            try
            {
                if (ClassName == null)
                {
                    ClassName = "";
                }
                archive.GetData(_ArchiveCode);
                JFile image = archive.RetrieveContent(archive.ArchiveCode);
                if (image == null)
                {
                    return(false);
                }
                ClassName  = archive.ClassName;
                ObjectCode = archive.ObjectCode;
                this.Image = System.Drawing.Image.FromStream(image.Stream);
                object tObject = this.Image;
                JSystem.AddObject(ref tObject);

                return(true);
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
                return(false);
            }
            finally
            {
                archive.Dispose();
            }
        }
Esempio n. 2
0
        private void jdgRequestList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (jdgRequestList.SelectedRows.Count == 0)
            {
                return;
            }
            JFile content;

            try
            {
                int Status = 0;
                if (this.State == JFormState.Update)
                {
                    if (jdgRequestList.DataSource == null)
                    {
                        Status = Convert.ToInt32(jdgRequestList[0, jdgRequestList.SelectedRows[0].Index].Value);
                    }
                    else
                    {
                        Status = Convert.ToInt32(jdgRequestList.CurrentRow.Cells["Status"].Value);
                    }
                }
                if (ClassLibrary.Domains.Employment.JVacationStatus.Confirm == Status)//
                {
                    /// در صورتی که فایل جدیداً به لیست اضافه شده، بازیابی نمیشود، بلکه محتوای فایل از دیتاتیبل خوانده میشود
                    //if (e.RowIndex != -1)
                    /// کد آرشیو انتخاب شده در گرید
                    int Code = Convert.ToInt32(jdgRequestList[JArchiveFields.ArchiveCode.ToString(), jdgRequestList.SelectedRows[0].Index].Value);
                    JArchiveDocument archive = new JArchiveDocument();
                    archive.GetData(Code);
                    try
                    {
                        //// بازیابی محتوای آرشیو
                        content = archive._RetrieveContent(archive.ArchiveCode);
                        content.Open();
                    }
                    catch (Exception ex)
                    {
                        JSystem.Except.AddException(ex);
                    }
                    finally
                    {
                        archive.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// وضعیت
        /// </summary>
        //public int Status { get; set; }
        #endregion

        #region method
        /// <summary>
        /// درج
        /// </summary>
        /// <returns></returns>
        public int Insert(DataTable pArchiveList)
        {
            if (JPermission.CheckPermission("ArchivedDocuments.JRequestArchiveFile.Insert"))
            {
                JDataBase tempDb             = new JDataBase();
                JRequestArchiveFileTable JLT = new JRequestArchiveFileTable();
                JRequestArchiveList      tmpRequestArchiveList = new JRequestArchiveList();
                JArchiveDocument         tmpArchiveDocument    = new JArchiveDocument();
                try
                {
                    tempDb.beginTransaction("JRequestArchiveFile");
                    JLT.SetValueProperty(this);
                    Code = JLT.Insert(tempDb);
                    if (Code > 0)
                    {
                        foreach (DataRow dr in pArchiveList.Rows)
                        {
                            tmpRequestArchiveList.RequestCode = Code;
                            tmpRequestArchiveList.ArchiveCode = Convert.ToInt32(dr["ArchiveCode"]);
                            if (dr["Confirm_Post_Code"].ToString() != "")
                            {
                                tmpRequestArchiveList.Confirm_Post_Code = Convert.ToInt32(dr["Confirm_Post_Code"].ToString());
                            }
                            tmpRequestArchiveList.Confirm_Full_Title = dr["Confirm_Full_Title"].ToString();
                            if (dr["Confirm_User_Code"].ToString() != "")
                            {
                                tmpRequestArchiveList.Confirm_User_Code = Convert.ToInt32(dr["Confirm_User_Code"].ToString());
                            }
                            tmpRequestArchiveList.Status = ClassLibrary.Domains.Employment.JVacationStatus.Request;// Convert.ToInt32(dr["Status"].ToString());
                            //if (dr["StartDate"].ToString() != "")
                            //    tmpRequestArchiveList.StartDate = Convert.ToDateTime(dr["StartDate"]);
                            //if (dr["EndDate"].ToString() != "")
                            //    tmpRequestArchiveList.EndDate = Convert.ToDateTime(dr["EndDate"]);
                            //tmpRequestArchiveList.Description = dr["Description"].ToString();
                            if (tmpRequestArchiveList.Insert(tempDb) < 1)
                            {
                                tempDb.Rollback("JRequestArchiveFile");
                                return(0);
                            }
                            tmpArchiveDocument.GetData(tmpRequestArchiveList.ArchiveCode);
                            if (tmpArchiveDocument.PlaceCode == 0)
                            {
                                tempDb.Rollback("JRequestArchiveFile");
                                JMessages.Error("مکان آرشیو این فایل تعیین نشده است ", "");
                                return(0);
                            }
                            if (!(SendConfirm(tempDb, tmpArchiveDocument.PlaceCode)))
                            {
                                tempDb.Rollback("JRequestArchiveFile");
                                JMessages.Error("Send Not Successfuly ", "");
                                return(0);
                            }
                        }
                        if (tempDb.Commit())
                        {
                            return(Code);
                        }
                        else
                        {
                            tempDb.Rollback("JRequestArchiveFile");
                            return(0);
                        }
                    }
                    else
                    {
                        return(0);
                    }
                }
                catch (Exception ex)
                {
                    JSystem.Except.AddException(ex);
                    tempDb.Rollback("JRequestArchiveFile");
                    return(0);
                }
                finally
                {
                    tempDb.Dispose();
                    JLT.Dispose();
                    tmpRequestArchiveList.Dispose();
                    tmpArchiveDocument.Dispose();
                }
            }
            return(0);
        }