Esempio n. 1
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);
        }
Esempio n. 2
0
        private void btnConfirm()
        {
            try
            {
                //if (JPermission.CheckPermission("Employment.JVacationHourForm.Confirm"))
                //{
                if (State == JFormState.Update)
                {
                    //if (_Status == ClassLibrary.Domains.Employment.JVacationStatus.Request)
                    //{
                    JRequestArchiveList tmpRequestArchiveList = new JRequestArchiveList();
                    for (int i = 0; i < jdgRequestList.Rows.Count; i++)
                    {
                        tmpRequestArchiveList.GetData(Convert.ToInt32(jdgRequestList.Rows[i].Cells["Code"].Value));
                        tmpRequestArchiveList.Status = Convert.ToInt32(jdgRequestList.Rows[i].Cells[0].Value);    // ClassLibrary.Domains.Employment.JVacationStatus.Confirm;
                        if (jdgRequestList.Rows[i].Cells["StartDate"].Value.ToString() != "")
                        {
                            tmpRequestArchiveList.StartDate = Convert.ToDateTime(jdgRequestList.Rows[i].Cells["StartDate"].Value);
                        }
                        if (jdgRequestList.Rows[i].Cells["EndDate"].Value.ToString() != "")
                        {
                            tmpRequestArchiveList.EndDate = Convert.ToDateTime(jdgRequestList.Rows[i].Cells["EndDate"].Value);
                        }
                        tmpRequestArchiveList.Description        = jdgRequestList.Rows[i].Cells["Description"].Value.ToString();
                        tmpRequestArchiveList.Confirm_Full_Title = JMainFrame.CurrentPostTitle;
                        tmpRequestArchiveList.Confirm_Post_Code  = JMainFrame.CurrentPostCode;
                        tmpRequestArchiveList.Confirm_User_Code  = JMainFrame.CurrentUserCode;
                        if (!(tmpRequestArchiveList.Update()))
                        {
                            JMessages.Message("تایید با خطا مواجه شده  ", "", JMessageType.Error);
                            return;
                        }
                    }
                    //JArchive.ClassName = "ArchivedDocuments.JRequestArchiveFileForm";
                    //JArchive.SubjectCode = 0;
                    //JArchive.PlaceCode = 0;

                    //----------Update Archive------------
                    //    tmpRequestArchiveList.Code = _Code;
                    //    if (tmpRequestArchiveList.Update())//_ArchiveList
                    //    //if (tmpRequestArchiveFile.SendConfirmFinal(_Refer_Code))
                    //    {
                    //        //JArchive.ObjectCode = _Code;
                    //        //JArchive.ArchiveList();
                    //        JMessages.Message("تایید با موفقیت انجام گردید ", "", JMessageType.Information);
                    //        this.Close();
                    //    }
                    //    else
                    //        JMessages.Message("تایید با خطا مواجه شده  ", "", JMessageType.Error);
                    //}
                    //else
                    //    JMessages.Message("درخواست تایید شده قابل ویرایش نیست ", "", JMessageType.Information);
                }
                else
                {
                    JMessages.Message(" ابتدا درخواست را ثبت کنید ", "", JMessageType.Error);
                }
                //}
            }
            catch (Exception ex)
            {
                //Except.AddException(ex);
            }
        }