Esempio n. 1
0
 private void JRequestArchiveFileForm_Load(object sender, EventArgs e)
 {
     try
     {
         if (State == JFormState.Update)
         {
             Set_Form();
         }
         else
         {
             jdgRequestList.Columns.Clear();
             lblRequester.Text         = JMainFrame.BaseCurrentPostTitle;
             _ArchiveList              = JRequestArchiveFile.GetDataTableArchiveFile(_ArchiveCode, 0);
             jdgRequestList.DataSource = _ArchiveList;
             txtRequestDate.Date       = JDateTime.Now();
         }
         jdgRequestList.Columns["Code"].Visible                = false;
         jdgRequestList.Columns["RequestCode"].Visible         = false;
         jdgRequestList.Columns["ArchiveCode"].Visible         = false;
         jdgRequestList.Columns["Confirm_Post_Code"].Visible   = false;
         jdgRequestList.Columns["Confirm_User_Code"].Visible   = false;
         jdgRequestList.Columns["status"].Visible              = false;
         jdgRequestList.Columns["Status"].ReadOnly             = true;
         jdgRequestList.Columns["RegisterDate"].ReadOnly       = true;
         jdgRequestList.Columns["Subject"].ReadOnly            = true;
         jdgRequestList.Columns["ArchiveFileDesc"].ReadOnly    = true;
         jdgRequestList.Columns["Confirm_Full_Title"].ReadOnly = true;
     }
     catch (Exception ex)
     {
         JSystem.Except.AddException(ex);
     }
 }
Esempio n. 2
0
        private void Set_Form()
        {
            try
            {
                JRequestArchiveFile tmpRequestArchiveFile = new JRequestArchiveFile(_Code);
                lblRequester.Text   = tmpRequestArchiveFile.Requester_Full_Title;
                txtRequestDate.Date = tmpRequestArchiveFile.RequestDate;
                //_Status = tmpRequestArchiveFile.Status;

                groupBox2.Enabled = true;
                if (JRequestArchiveFile.CheckConfirm(tmpRequestArchiveFile.Requester_Post_Code)) //&& _Status == ClassLibrary.Domains.Employment.JVacationStatus.Request)
                {
                    //gbConfirm.Enabled = true;
                    _NextStatus = ClassLibrary.Domains.Employment.JVacationStatus.Confirm;
                    //btnBack.Visible = true;

                    DataGridViewComboBoxColumn comboboxColumn;
                    comboboxColumn               = CreateComboBoxColumn();
                    comboboxColumn.DataSource    = ClassLibrary.Domains.JGlobal.JStatusArchive.GetData();
                    comboboxColumn.DisplayMember = "FarsiName";
                    comboboxColumn.ValueMember   = "Value";
                    //comboboxColumn.Name = "Status";
                    jdgRequestList.Columns.Insert(0, comboboxColumn);
                    btnSave.Text = "تایید";
                    //_ArchiveList = JRequestArchiveFile.GetDataTableArchiveFile(0, _Code);
                    //jdgRequestList.DataSource = _ArchiveList;
                    string[] row0  = { "", "", "", "", "", "", "", "", "", "", "", "", "" };
                    int      count = 0;
                    foreach (DataRow dr in JRequestArchiveFile.GetDataTableArchiveFile(0, _Code).Rows)
                    {
                        row0[0]  = dr["Status"].ToString();
                        row0[1]  = dr["RegisterDate"].ToString();
                        row0[2]  = dr["Subject"].ToString();
                        row0[3]  = dr["ArchiveFileDesc"].ToString();
                        row0[4]  = dr["Code"].ToString();
                        row0[5]  = dr["RequestCode"].ToString();
                        row0[6]  = dr["Confirm_Post_Code"].ToString();
                        row0[7]  = dr["Confirm_Full_Title"].ToString();
                        row0[8]  = dr["Confirm_User_Code"].ToString();
                        row0[9]  = dr["StartDate"].ToString();
                        row0[10] = dr["EndDate"].ToString();
                        row0[11] = dr["Description"].ToString();
                        row0[12] = dr["ArchiveCode"].ToString();
                        jdgRequestList.Rows.Add(row0);
                        //jdgRequestList.Rows[count].Cells[0].Value = Convert.ToInt32(dr["Status"].ToString());
                        count++;
                    }
                    //_ArchiveList =  jdgRequestList.DataSource;
                }
                else
                {
                    btnSave.Enabled = false;
                    jdgRequestList.Columns.Clear();
                    _ArchiveList = JRequestArchiveFile.GetDataTableArchiveFile(0, _Code);
                    jdgRequestList.DataSource = _ArchiveList;
                }
                //if (tmpRequestArchiveFile.CheckConfirmFinal(_Refer_Code) && _Status == ClassLibrary.Domains.Employment.JVacationStatus.Confirm)
                //{
                //    gbConfirm.Enabled = true;
                //    _NextStatus = ClassLibrary.Domains.Employment.JVacationStatus.Personnel;
                //    btnBack.Visible = true;
                //}
                //if (_Status == ClassLibrary.Domains.Employment.JVacationStatus.NotConfirm)
                //    lblStatus.Text = "وضعیت " + " عدم تایید ";
                if ((_Status == ClassLibrary.Domains.Employment.JVacationStatus.Request) || (_Status == 0))
                {
                    //lblStatus.Text = "وضعیت " + " درخواست ";
                    if ((tmpRequestArchiveFile.Requester_Post_Code == JMainFrame.CurrentPostCode) && (_Refer_Code > 0))
                    {
                        Automation.JARefer tmpRefer = new Automation.JARefer(_Refer_Code);
                        if (tmpRefer.receiver_post_code == JMainFrame.CurrentPostCode)
                        {
                            groupBox2.Enabled = true;
                            btnSave.Enabled   = true;
                        }
                        else
                        {
                            btnSave.Enabled = false;
                        }
                    }
                    else
                    {
                        //if (gbConfirm.Enabled == false)
                        //    btnSave.Enabled = false;
                        //btnSave.Text = "تایید";
                    }
                }
                else if (_Status == ClassLibrary.Domains.Employment.JVacationStatus.Confirm)
                {
                    //lblStatus.Text = "وضعیت " + " تایید ";
                    btnSave.Text = "تایید";
                    //if (gbConfirm.Enabled == false)
                    //    btnSave.Enabled = false;
                }
                //else if (_Status == ClassLibrary.Domains.Employment.JVacationStatus.Personnel)
                //{
                //    lblStatus.Text = "وضعیت " + " تایید کارگزینی ";
                //    btnSave.Text = "تایید";
                //    btnSave.Enabled = false;
                //    gbConfirm.Enabled = false;
                //}
                else if (_Status == ClassLibrary.Domains.Employment.JVacationStatus.NotConfirm)
                {
                    //rbNoConfirm.Checked = true;
                    btnSave.Enabled = false;
                }
                else if (_Status == 0)
                {
                    groupBox2.Enabled = true;
                    btnSave.Enabled   = true;
                }

                //juC_ReferHistory.SetData(_Code, ClassLibrary.Domains.JAutomation.JObjectType.ArchiveRequest);
                //juC_ReferHistory.ReferGroup = new int[] { 1, 2, 3 };
            }
            catch (Exception ex)
            {
                //Except.AddException(ex);
            }
        }
Esempio n. 3
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            JDataBase db = new JDataBase();

            try
            {
                db.beginTransaction("Back ArchiveFile");
                if (_Refer_Code > 0 && _Code > 0)
                {
                    JTextInputDialogForm Tdialog = new JTextInputDialogForm("Refer", "Back...");
                    Tdialog.ShowDialog();
                    if (Tdialog.DialogResult == DialogResult.OK)
                    {
                        JRequestArchiveFile tmpRequestArchiveFile = new JRequestArchiveFile(_Code);

                        Automation.JARefer _temprefer = new Automation.JARefer(_Refer_Code);
                        Automation.JARefer refer      = new Automation.JARefer();
                        refer.receiver_code       = tmpRequestArchiveFile.Requester_User_Code;
                        refer.receiver_full_title = tmpRequestArchiveFile.Requester_Full_Title;
                        refer.receiver_post_code  = tmpRequestArchiveFile.Requester_Post_Code;

                        refer.description = Tdialog.Text;

                        refer.sender_code       = JMainFrame.CurrentUserCode;
                        refer.sender_full_title = JMainFrame.CurrentPostTitle;
                        refer.sender_post_code  = JMainFrame.CurrentPostCode;

                        refer.object_code = _temprefer.object_code;
                        refer.ReferLevel  = _temprefer.ReferLevel + 1;
                        refer.parent_code = _temprefer.Code;
                        refer.ReferGroup  = _temprefer.ReferGroup;

                        refer.refertype      = ClassLibrary.Domains.JAutomation.JReferType.Internal;
                        refer.send_date_time = (new JDataBase().GetCurrentDateTime());
                        refer.status         = ClassLibrary.Domains.JAutomation.JReferStatus.Current;
                        refer.is_active      = true;

                        //tmpRequestArchiveFile.Status = 0;// ClassLibrary.Domains.Employment.JVacationStatus.Request;
                        if (tmpRequestArchiveFile.Update(db, false))
                        {
                            db.Commit();
                            db.beginTransaction("Back ArchiveFile");
                            if (refer.Send(db) > 0)
                            {
                                db.Commit();
                                this.Close();
                                return;
                            }
                            else
                            {
                                db.Rollback("Back ArchiveFile");
                            }
                        }
                        else
                        {
                            db.Rollback("Back ArchiveFile");
                        }
                    }
                }
                db.Rollback("Back ArchiveFile");
            }
            catch
            {
                db.Rollback("Back ArchiveFile");
            }
            finally
            {
                db.Dispose();
            }
        }
Esempio n. 4
0
        private bool Save()
        {
            try
            {
                #region CheckData
                if (jdgRequestList.Rows.Count < 1)
                {
                    JMessages.Message(" لطفا فایل آرشیو را انتخاب کنید ", "", JMessageType.Error);
                    return(false);
                }
                #endregion

                JRequestArchiveFile tmpRequestArchiveFile = new JRequestArchiveFile();
                tmpRequestArchiveFile.Requester_Post_Code  = JMainFrame.CurrentPostCode;
                tmpRequestArchiveFile.Requester_Full_Title = JMainFrame.CurrentPostTitle;
                tmpRequestArchiveFile.Requester_User_Code  = JMainFrame.CurrentUserCode;
                tmpRequestArchiveFile.RequestDate          = txtRequestDate.Date;
                //if (State == JFormState.Update)
                //    tmpRequestArchiveFile.Status = ClassLibrary.Domains.Employment.JVacationStatus.Request;
                //else
                //    tmpRequestArchiveFile.Status = _Status;
                //JArchive.ClassName = "ArchivedDocuments.JRequestArchiveFileForm";
                //JArchive.SubjectCode = 0;
                //JArchive.PlaceCode = 0;

                //---------ویرایش------------
                if (State == JFormState.Update)
                {
                    //if ((tmpRequestArchiveFile.Status == ClassLibrary.Domains.Employment.JVacationStatus.Request) || (_Status == 0))
                    //{
                    //----------Update Archive------------
                    tmpRequestArchiveFile.Code = _Code;
                    if (_Refer_Code > 0)
                    {
                        tmpRequestArchiveFile._Refer_Code = _Refer_Code;
                    }
                    if (tmpRequestArchiveFile.Update(_ArchiveList))
                    {
                        //JArchive.ObjectCode = _Code;
                        //JArchive.ArchiveList();
                        JMessages.Message("Update Successfuly ", "", JMessageType.Information);
                        return(true);
                    }
                    else
                    {
                        JMessages.Message("Update Not Successfuly ", "", JMessageType.Error);
                    }
                    //}
                    //else
                    //    JMessages.Message("درخواست تایید شده قابل ویرایش نیست ", "", JMessageType.Error);
                }
                else
                {
                    //tmpRequestArchiveFile.Status = ClassLibrary.Domains.Employment.JVacationStatus.Request;
                    _Code = tmpRequestArchiveFile.Insert(_ArchiveList);
                    if (_Code > 0)
                    {
                        //JArchive.ObjectCode = _Code;
                        //JArchive.ArchiveList();
                        JMessages.Message("Insert Successfuly ", "", JMessageType.Information);
                        return(true);
                    }
                    else
                    {
                        JMessages.Message(" Insert Not Successfuly ", "", JMessageType.Error);
                    }
                }
                return(false);
            }
            catch (Exception ex)
            {
                //Except.AddException(ex);
                return(false);
            }
        }