Example #1
0
 private void CancelLadBillForm_Load(object sender, EventArgs e)
 {
     LadBillCreditTextBox.Focus();
     if (HPS.Common.CurrentUser.user.UserGroupID_int != 1)
     {
         LadBillWithTrafficGridView.Columns["LadeUser"].Visible         = false;
         LadBillWithTrafficGridView.Columns["CanceledUserName"].Visible = false;
         LadBillWithTrafficGridView.Columns["colUserName_nvc"].Visible  = false;
     }
 }
Example #2
0
        private void CancelationButton_Click(object sender, EventArgs e)
        {
            Int64?    TrafficID_bint = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillWithTrafficGridView.CurrentRow.Cells["colTrafficID_bint"].Value, TypeCode.Int64);
            DataTable OutDatatable   = new DataTable();

            HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
            try
            {
                if (LadBillWithTrafficGridView.CurrentRow != null)
                {
                    bool?Canceled_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillWithTrafficGridView.CurrentRow.Cells["colCanceled_bit"].Value, TypeCode.Boolean);
                    if (Canceled_bit.HasValue && Canceled_bit == true)
                    {
                        throw new ApplicationException("این مجوز باطل شده است");
                    }
                    else
                    {
                        //TrafficFactory.GetAllByCondition(string.Format("[Traffic_T].Out_bit=1 and [Traffic_T].TrafficNumber_bint={0}", LadBillWithTrafficGridView.CurrentRow.Cells["TrafficNumber_bint"].Value), ref OutDatatable);
                        //if (OutDatatable.Rows.Count == 0)
                        //{
                        //    //throw new ApplicationException("این خودرو خارج نشده است");
                        //    Hepsa.Core.Common.MessageBox.ErrorMessage("این خودرو خارج نشده است");
                        //}
                        this.LastRowIndex = LadBillWithTrafficGridView.CurrentRow.Index;
                        int?LadBillCreditID_int = (int?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillWithTrafficGridView.CurrentRow.Cells["LadBillCreditID_int"].Value, TypeCode.Int32);
                        if (LadBillCreditID_int.HasValue)
                        {
                            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys key = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys();
                            key.LadBillCreditID_int = LadBillCreditID_int.Value;
                            HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LaKey = new BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys();
                            HPS.BLL.TrafficBLL.BLLTraffic_TKeys TrafficKey          = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
                            TrafficKey.TrafficID_bint   = Convert.ToInt64(this.LadBillWithTrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value);
                            LaKey.LadeAssignmentID_bint = Convert.ToInt64(this.LadBillWithTrafficGridView.CurrentRow.Cells["LadeAssignmentID_bint"].Value);
                            HPS.Present.CancelLadBillCreditComment.CancelLadBillCreditCommentForm CancelLadBillCreditCommentForm = new HPS.Present.CancelLadBillCreditComment.CancelLadBillCreditCommentForm((DataTable)this.LadBillWithTrafficGridView.DataSource, key, LaKey, TrafficKey);
                            CancelLadBillCreditCommentForm.ShowDialog();
                        }
                    }
                }
                LadBillCreditTextBox.Focus();
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }