Exemplo n.º 1
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (Validate())
     {
         JAUTVacation vacation = new JAUTVacation(_Code);
         vacation.Description  = txtDesc.Text;
         vacation.DriverPCode  = personDriver.SelectedCode;
         vacation.FromDate     = JDateTime.GregorianDate(txtFromDate.Text, txtFromTime.Text);
         vacation.ToDate       = JDateTime.GregorianDate(txtToDate.Text, txtToTime.Text);
         vacation.VacationType = Convert.ToInt32(cmbVationType.SelectedValue);
         if (_Code == 0)
         {
             if (vacation.Insert(_DriverPCode > 0) > 0)
             {
                 DialogResult = System.Windows.Forms.DialogResult.OK;
             }
             else
             {
                 JMessages.Error("عملیات ثبت با مشکل مواجه شده است", "");
             }
         }
         else
         {
             if (vacation.Update())
             {
                 DialogResult = System.Windows.Forms.DialogResult.OK;
             }
             else
             {
                 JMessages.Error("عملیات ثبت با مشکل مواجه شده است", "");
             }
         }
     }
 }
Exemplo n.º 2
0
        private void jJanusGrid1_OnRowDBClick(object Sender, Janus.Windows.GridEX.RowActionEventArgs e)
        {
            if (groupBox1.Enabled == false)
            {
                DataRowView SelectedRow = ((DataRowView)jJanusGrid1.SelectedRow);

                _BascolCode       = Convert.ToInt32(SelectedRow.Row["BascoolCode"]);
                _Weight           = Convert.ToInt32(SelectedRow.Row["Weights"]);
                _Date             = JDateTime.GregorianDate(SelectedRow.Row["WDate"].ToString());
                this.DialogResult = DialogResult.OK;
                Close();
            }
            _Code         = Convert.ToInt32(jJanusGrid1.SelectedRow.Row["Code"]);
            txtPrice.Text = jJanusGrid1.SelectedRow.Row["pay_h"].ToString();
        }
Exemplo n.º 3
0
 private bool Validate()
 {
     if (personDriver.SelectedCode == 0)
     {
         JMessages.Error("لطفاً راننده را انتخاب کنید.", "");
         return(false);
     }
     if (cmbVationType.SelectedValue == null)
     {
         JMessages.Error("لطفاً نوع مرخصی را انتخاب کنید.", "");
         return(false);
     }
     if (txtFromDate.Date == DateTime.MinValue)
     {
         JMessages.Error("لطفاً تاریخ شروع را وارد کنید.", "");
         return(false);
     }
     if (txtFromTime.Text == "")
     {
         JMessages.Error("لطفاً ساعت شروع را وارد کنید.", "");
         return(false);
     }
     if (txtToDate.Date == DateTime.MinValue)
     {
         JMessages.Error("لطفاً تاریخ پایان را وارد کنید.", "");
         return(false);
     }
     if (txtToTime.Text == "")
     {
         JMessages.Error("لطفاً ساعت پایان را وارد کنید.", "");
         return(false);
     }
     if (JDateTime.GregorianDate(txtFromDate.Text, txtFromTime.Text) >= JDateTime.GregorianDate(txtToDate.Text, txtToTime.Text))
     {
         JMessages.Error("لطفاً تاریخ شروع و پایان را بصورت صحیح وارد کنید.", "");
         return(false);
     }
     return(true);
 }
Exemplo n.º 4
0
        private void SendRefer()
        {
            JDataBase db = JGlobal.MainFrame.GetDBO();

            try
            {
                if (_dt.Rows.Count == 0)
                {
                    if ((cdbReferInternal.SelectedValue != null) && (Convert.ToInt32(cdbReferInternal.SelectedValue) != -1))
                    {
                        if (rchDesc.Text.Trim() == "")
                        {
                            JMessages.Error("لطفا توضیحات را وارد کنید.", "Error");
                            return;
                        }
                        btnAddRefer_Click(null, null);
                    }
                    else
                    {
                        JMessages.Error("Please Add One Refer", "Error");
                        return;
                    }
                }

                JARefer tmprefer = new JARefer();
                if (_AutomationObjectCode == 0)
                {
                    _AutomationObjectCode = tmprefer.SendToAutomation(_ExternalObjectCode, _ObjectType, _Description, _Title, _ClassName, db,
                                                                      JMainFrame.CurrentPostTitle, JMainFrame.CurrentPostCode, JMainFrame.CurrentUserCode, false);
                }
                int Code = 0;
                tmprefer.parent_code = GetMainReferCode(_ReferCode);
                // در صورتیکه اولین بار ارجاع شود
                if (_Refer.object_code != 0)
                {
                    tmprefer.object_code = _Refer.object_code;
                }
                else
                {
                    tmprefer.object_code = _AutomationObjectCode;
                }
                //btnAddRefer_Click(null, null);
                foreach (DataRow dr in _dt.Rows)
                {
                    db.beginTransaction("ReferRegister");
                    //ارسال به داخل سازمان
                    //if (tbcReferType.TabPages[tbcReferType.SelectedIndex].Name == "tbpInternalrefer")
                    //{
                    tmprefer.receiver_post_code  = Convert.ToInt32(dr["receiver_post_code"]); //Convert.ToInt32(cdbReferInternal.SelectedItem["code"]);
                    tmprefer.receiver_code       = Convert.ToInt32(dr["receiver_code"]);      //Convert.ToInt32(cdbReferInternal.SelectedItem["user_code"]);
                    tmprefer.receiver_full_title = dr["receiver_full_title"].ToString();      //cdbReferInternal.SelectedItem["full_title"].ToString();
                    tmprefer.refertype           = Convert.ToInt32(dr["refertype"]);          //ClassLibrary.Domains.JAutomation.JReferType.Internal;
                    //}
                    //ارسال به خارج از سازمان
                    //else
                    //{
                    //    tmprefer.receiver_post_code = Convert.ToInt32(cdbReferExternal.SelectedItem["code"]);
                    //    tmprefer.receiver_code = Convert.ToInt32(cdbReferExternal.SelectedItem["user_code"]);
                    //    tmprefer.receiver_full_title = cdbReferExternal.SelectedItem["full_title"].ToString();
                    //    tmprefer.refertype = ClassLibrary.Domains.JAutomation.JReferType.External;
                    //}

                    tmprefer.task_code = 0;
                    // ارسال کننده
                    JUser user = new JUser(JMainFrame.CurrentUserCode);
                    tmprefer.sender_post_code  = JMainFrame.CurrentPostCode;
                    tmprefer.sender_code       = JMainFrame.CurrentUserCode;
                    tmprefer.sender_full_title = JMainFrame.CurrentPostTitle;

                    tmprefer.send_date_time = JMainFrame.GlobalDataBase.GetCurrentDateTime();
                    tmprefer.status         = ClassLibrary.Domains.JAutomation.JReferStatus.Current;
                    tmprefer.secret_level   = Convert.ToInt32(dr["secret_level"]);//Convert.ToInt32(cmbsecuritylevel.SelectedValue);
                    tmprefer.is_active      = true;

                    if ((dr["respite_date_time"] != "") && (Convert.ToDateTime(dr["respite_date_time"]) != DateTime.MinValue))
                    {
                        tmprefer.respite_date_time = JDateTime.GregorianDate(dr["respite_date_time"].ToString());
                    }
                    //if (!nedPersuit.EmptyDate)
                    //    tmprefer.respite_date_time = Convert.ToDateTime(nedPersuit.Text);

                    tmprefer.urgency        = Convert.ToInt32(dr["urgency"]);  //Convert.ToInt32(cmbUrgency.SelectedValue);
                    tmprefer.message        = dr["message"].ToString();        //txtNormalEmperise.Text.Trim();
                    tmprefer.message_secret = dr["message_secret"].ToString(); //txtSecretEmperise.Text.Trim();
                    tmprefer.description    = dr["description"].ToString();    //rchDesc.Text;

                    tmprefer.register_user_code = JMainFrame.CurrentUserCode;
                    tmprefer.register_Date_Time = JMainFrame.GlobalDataBase.GetCurrentDateTime();

                    Code = tmprefer.Send(db);
                    if (Code > 0)
                    {
                        if (_ReferCode > 0)
                        {
                            _Refer.status = ClassLibrary.Domains.JAutomation.JReferStatus.Sent;
                            if (_Refer.Save(db))
                            {
                                if (db.Commit())
                                {
                                    isSendRefer               = true;
                                    jArchiveList1.ClassName   = "Automation.JARefer";
                                    jArchiveList1.SubjectCode = 0;
                                    jArchiveList1.ObjectCode  = Code;
                                    jArchiveList1.ArchiveList();

                                    JMessages.Message(JLanguages._Text("Send With Number ") + "  " + Code.ToString() + " " + JLanguages._Text("Successfuly"), "Send", JMessageType.Information);

                                    if ((JSystem.Nodes.CurrentNode != null) && (JSystem.Nodes.CurrentNode.ClassName == "Automation.JKartable"))
                                    {
                                        JSystem.Nodes.Delete(JSystem.Nodes.CurrentNode);
                                    }


                                    //----Refresh Kartabl
                                    //JKartable tmp = new JKartable();
                                    //tmp.GetInBoxRefer();
                                }
                                else
                                {
                                    db.Rollback(db.TransactionName);
                                    JMessages.Message("Send Not Successfully", "", JMessageType.Error);
                                }
                            }
                            else
                            {
                                db.Rollback(db.TransactionName);
                                JMessages.Message("Send Not Successfully", "", JMessageType.Error);
                            }
                        }
                        else
                        if ((_ReferCode < 0) && (_AutomationObjectCode < 0))
                        {
                            db.Rollback(db.TransactionName);
                            JMessages.Message("Send Not Successfully", "", JMessageType.Information);
                        }
                        else
                        if (db.Commit())
                        {
                            isSendRefer               = true;
                            jArchiveList1.ClassName   = "Automation.JARefer";
                            jArchiveList1.SubjectCode = 0;
                            jArchiveList1.ObjectCode  = Code;
                            jArchiveList1.ArchiveList();

                            JMessages.Message(JLanguages._Text("Send With Number ") + "  " + Code.ToString() + " " + JLanguages._Text("Successfuly"), "Send", JMessageType.Information);

                            if ((JSystem.Nodes.CurrentNode != null) && (JSystem.Nodes.CurrentNode.ClassName == "Automation.JKartable"))
                            {
                                JSystem.Nodes.Delete(JSystem.Nodes.CurrentNode);
                            }
                            //----Refresh Kartabl
                            //JKartable tmp = new JKartable();
                            //tmp.GetInBoxRefer();
                        }
                        else
                        {
                            JMessages.Message("Send Not Successfully", "", JMessageType.Information);
                        }
                    }
                    else
                    {
                        db.Rollback(db.TransactionName);
                        JMessages.Message("Send Not Successfully", "", JMessageType.Information);
                    }
                }
                if (jdgvRefer.Rows.Count > 0)
                {
                    this.DialogResult = DialogResult.OK;
                }
                this.Close();
            }
            catch (Exception ex)
            {
                JBase.Except.AddException(ex);
            }
        }
Exemplo n.º 5
0
        public bool Update(DataTable tmpdt)
        {
            JTruckTable PDT = new JTruckTable();
            JDataBase   db  = new JDataBase();

            try
            {
                if (tmpdt != null)
                {
                    db.beginTransaction("InsertTruck");
                    foreach (DataRow dr in tmpdt.Rows)
                    {
                        if (dr.RowState == DataRowState.Added)
                        {
                            Name      = dr["Name"].ToString();
                            StartDate = Convert.ToDateTime(dr["StartDate"]);
                            EndDate   = Convert.ToDateTime(dr["EndDate"]);
                            Price     = Convert.ToInt32(dr["Price"]);
                            Shortcut  = dr["Shortcut"].ToString();
                            Insert(db);
                            dr["Code"] = Code;
                            if (Code < 1)
                            {
                                return(false);
                            }
                        }
                        if (dr.RowState == DataRowState.Modified)
                        {
                            Name      = dr["Name"].ToString();
                            StartDate = JDateTime.GregorianDate(dr["StartDate"].ToString());
                            EndDate   = JDateTime.GregorianDate(dr["EndDate"].ToString());
                            Price     = Convert.ToInt32(dr["Price"]);
                            Shortcut  = dr["Shortcut"].ToString();
                            Code      = Convert.ToInt32(dr["Code"]);
                            if (!Update(db))
                            {
                                return(false);
                            }
                        }
                        if (dr.RowState == DataRowState.Deleted)
                        {
                            dr.RejectChanges();
                            Code = (int)dr["Code"];
                            GetData(Code);
                            if (!Delete(db))
                            {
                                return(false);
                            }
                            dr.Delete();
                        }
                    }
                    tmpdt.AcceptChanges();
                    if (db.Commit())
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                db.Rollback("InsertTruck");
                Except.AddException(ex);
                return(false);
            }
            finally
            {
                PDT.Dispose();
                db.Dispose();
            }
        }