コード例 #1
0
        private void LadBillCrediteID_binttextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (string.IsNullOrEmpty(LadBillCrediteID_binttextBox.Text) == false)
                {
                    DriverCardNumber_nvctextBox.Text    = string.Empty;
                    AcceptedTurnNumber_binttextBox.Text = string.Empty;
                    NationalCode_inttextBox.Text        = string.Empty;
                    DriverLastName_nvctextBox.Text      = string.Empty;
                    NumberPlate_nvctextBox.Text         = string.Empty;
                    CarSerialnumbertextBox.Text         = string.Empty;
                    FromDatefaDatePicker.ResetSelectedDateTime();
                    ToDatefaDatePicker.ResetSelectedDateTime();

                    HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                    DataTable LadBillCreditDataTable = new DataTable();
                    string    condition = string.Empty;
                    condition = string.Format(" LadBillCredit_T.LadBillCreditID_int='{0}'", LadBillCrediteID_binttextBox.Text);
                    LadBillFactory.GetAllWithTrafficLadBillCreditByConditon(condition, ref LadBillCreditDataTable);
                    LadBillWithTrafficGridView.DataSource = null;
                    LadBillWithTrafficGridView.DataSource = LadBillCreditDataTable;
                }
            }
        }
コード例 #2
0
        public LadBillCreditReport(string FromDate, string ToDate, bool productionYear)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
            string condition = string.Empty;

            if (productionYear == true)
            {
                condition = "LadBillCredit_T.Date_nvc>='" + FromDate + "' AND LadBillCredit_T.Date_nvc<='" + ToDate + "' AND Traffic_T.ProductionYear_int IS NOT NULL AND Canceled_bit=0";
            }
            else
            {
                condition = "LadBillCredit_T.Date_nvc>='" + FromDate + "' AND LadBillCredit_T.Date_nvc<='" + ToDate + "'";
            }

            DataTable LadBillCreditDataTable = new DataTable();

            LadBillFactory.GetAllWithTrafficLadBillCreditByConditon(condition, ref LadBillCreditDataTable);
            Fillfields(LadBillCreditDataTable);
            FromDatetxt.Text = FromDate;
            ToDatetxt.Text   = ToDate;
            DateTextBox.Text = LadBillFactory.ServerJalaliDate;
            TimeTextBox.Text = LadBillFactory.ServerTime;
        }
コード例 #3
0
        private void TurnPrintStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                string condition = "LadBillCredit_T.TrafficID_bint='" + Hepsa.Core.Common.PersentationController.GetEntityValue(this.TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value, TypeCode.Int64) + "' or (LadBillCredit_T.LadBillCreditID_int is not null and LadBillCredit_T.Canceled_bit=0 AND LadBillCredit_T.Turn_bit is not NULL)";
                List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T> LadBillCreditList = LadBillCreditFactory.GetAllByCondition(condition);

                if (LadBillCreditList != null && LadBillCreditList.Count > 0)
                {
                    bool?ladturn = LadBillCreditList[LadBillCreditList.Count - 1].Turn_bit;
                    if (LadBillCreditList[LadBillCreditList.Count - 1].Canceled_bit == false || (LadBillCreditList[LadBillCreditList.Count - 1].Canceled_bit == true && ladturn == false))
                    {
                        throw new ApplicationException("نوبت مورد نظر مجوز گرفته است");
                    }
                }
                HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
                string    conditionTurnManagement = string.Format("TurnManagement_T.TrafficID_bint='{0}' ", Hepsa.Core.Common.PersentationController.GetEntityValue(this.TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value, TypeCode.Int64));
                DataTable TurnManagementTable     = new DataTable();
                TurnManagementFactory.GetAllByCondition(conditionTurnManagement, ref TurnManagementTable);
                if (TurnManagementTable != null && TurnManagementTable.Rows.Count > 0)
                {
                    if (TurnManagementTable.Rows[TurnManagementTable.Rows.Count - 1]["Return_bit"].ToString() == "False")
                    {
                        throw new ApplicationException("نوبت مورد نظر باطل شده است");
                    }
                }

                //HPS.Reports.ReportDoc.AcceptedTurnReport rpt = new HPS.Reports.ReportDoc.AcceptedTurnReport((Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(this.TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value, TypeCode.Int64));
                //rpt.Document.Printer.PrinterName = string.Empty;
                //rpt.Run();

                //Properties.Settings s = new HPS.Properties.Settings();
                //if (string.IsNullOrEmpty(s.PrinterName))
                //{
                //    rpt.Document.Print(true, true, true);
                //}
                //else
                //{
                //    rpt.Document.Printer.PrinterName = s.PrinterName;
                //    rpt.Document.Print(false, true, true);
                //}
                ///


                HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory   = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                HPS.BLL.TrafficBLL.BLLTraffic_TKeys    TrafficKey       = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
                HPS.BLL.TrafficBLL.BLLTraffic_T        TrafficEntityrpt = new HPS.BLL.TrafficBLL.BLLTraffic_T();
                TrafficKey.TrafficID_bint = (Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(this.TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value, TypeCode.Int64);
                TrafficEntityrpt          = TrafficFactory.GetBy(TrafficKey);

                HPS.Reports.Forms.StimulViewer frm = new Reports.Forms.StimulViewer(TrafficEntityrpt, false, false);
                frm.ShowDialog();
                //
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #4
0
        private void WithProductionYearStripButton_Click(object sender, EventArgs e)
        {
            WithProductionYear = true;
            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
            DataTable LadBillCreditDataTable = new DataTable();
            string    condition = "Traffic_T.ProductionYear_int IS NOT NULL AND Canceled_bit=0";

            LadBillFactory.GetAllWithTrafficLadBillCreditByConditon(condition, ref LadBillCreditDataTable);
            LadBillWithTrafficGridView.Visible    = true;
            stiViewerControl1.Visible             = false;
            LadBillWithTrafficGridView.DataSource = LadBillCreditDataTable;
        }
コード例 #5
0
        private void ToDatefaDatePicker_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                    DataTable LadBillCreditDataTable = new DataTable();
                    ////////////////////////////////////////////////////////////////////////////////
                    if (FromDatefaDatePicker.IsNull)
                    {
                        throw new ApplicationException("از تاریخ خالی است");
                    }
                    else if (ToDatefaDatePicker.IsNull)
                    {
                        throw new ApplicationException("تا تاریخ خالی است");
                    }
                    ////////////////////////////////////////////////////////////////////////////////

                    Hepsa.Core.Validation.DateRule <string> FromDateValidator = new Hepsa.Core.Validation.DateRule <string>("FromDate", "از تاریخ", null, null);
                    if (FromDateValidator.Validate(FromDatefaDatePicker.Text) == false)
                    {
                        throw new ApplicationException(FromDateValidator.Description);
                    }

                    Hepsa.Core.Validation.DateRule <string> ToDateValidator = new Hepsa.Core.Validation.DateRule <string>("ToDate", "تا تاریخ", null, null);
                    if (ToDateValidator.Validate(ToDatefaDatePicker.Text) == false)
                    {
                        throw new ApplicationException(ToDateValidator.Description);
                    }
                    string condition = string.Empty;

                    condition = string.Format(" LadBillCredit_T.Date_nvc>='{0}' And LadBillCredit_T.Date_nvc<='{1}'", FromDatefaDatePicker.Text, ToDatefaDatePicker.Text);



                    if (WithProductionYear == true)
                    {
                        condition += " And ProductionYear_int IS NOT NULL AND Canceled_bit=0";
                    }

                    LadBillFactory.GetAllWithTrafficLadBillCreditByConditon(condition, ref LadBillCreditDataTable);
                    LadBillWithTrafficGridView.DataSource = null;
                    LadBillWithTrafficGridView.DataSource = LadBillCreditDataTable;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #6
0
        private void ShowConditionButton_Click(object sender, EventArgs e)
        {
            try
            {
                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                string condition = string.Empty;

                if (!string.IsNullOrEmpty(ToDatefaDatePicker.Text) && !string.IsNullOrEmpty(FromDatefaDatePicker.Text))
                {
                    condition = string.Format(" LadBillCredit_T.Date_nvc>='{0}' And LadBillCredit_T.Date_nvc<='{1}'", FromDatefaDatePicker.Text, ToDatefaDatePicker.Text);
                }

                if (!string.IsNullOrEmpty(LadBillCrediteID_binttextBox.Text))
                {
                    condition += string.Format(" OR LadBillCredit_T.LadBillCreditID_int='{0}'", LadBillCrediteID_binttextBox.Text);
                }

                if (!string.IsNullOrEmpty(AcceptedTurnNumber_binttextBox.Text))
                {
                    condition += string.Format(" OR Traffic_T.AcceptedTurnNumber_bint='{0}'", AcceptedTurnNumber_binttextBox.Text);
                }

                if (!string.IsNullOrEmpty(DriverCardNumber_nvctextBox.Text))
                {
                    condition += string.Format(" OR  Driver_T.DriverCardNumber_nvc='{0}'", DriverCardNumber_nvctextBox.Text);
                }

                if (!string.IsNullOrEmpty(NationalCode_inttextBox.Text))
                {
                    condition += string.Format(" OR Driver_T.NationalCode_int='{0}'", NationalCode_inttextBox.Text);
                }
                if (!string.IsNullOrEmpty(DriverLastName_nvctextBox.Text))
                {
                    condition += string.Format(" OR Driver_T.LastName_nvc='{0}'", DriverLastName_nvctextBox.Text);
                }
                if (!string.IsNullOrEmpty(CarSerialnumbertextBox.Text) && !string.IsNullOrEmpty(NumberPlate_nvctextBox.Text))
                {
                    condition += string.Format(" OR Car_T.NumberPlate_nvc='{0}' And Car_T.SerialPlate_nvc = '{1}'", NumberPlate_nvctextBox.Text, CarSerialnumbertextBox.Text);
                }
                DataTable LadBillCreditDataTable = new DataTable();
                LadBillWithTrafficGridView.Visible = true;
                stiViewerControl1.Visible          = false;
                LadBillFactory.GetAllWithTrafficLadBillCreditByConditon(condition, ref LadBillCreditDataTable);
                LadBillWithTrafficGridView.DataSource = null;
                LadBillWithTrafficGridView.DataSource = LadBillCreditDataTable;
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #7
0
 private void LoadAllLadBill()
 {
     try
     {
         HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
         LadBillWithTrafficDataTable = new DataTable();
         LadBillCreditFactory.GetActives(ref LadBillWithTrafficDataTable);
         this.LadBillWithTrafficGridView.DataSource = LadBillWithTrafficDataTable;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
コード例 #8
0
        public LadBillCreditReport(string FromDate, string ToDate, string CompanyList, string LaderTypeList, string OrderColumns, string NumberPlate_nvc, string SerialPlate_nvc, string CarCardNumber_nvc, string DriverCardNumber_nvc)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
            string condition = string.Empty;

            condition = "LadBillCredit_T.Date_nvc>='" + FromDate + "' AND LadBillCredit_T.Date_nvc<='" + ToDate + "' AND Canceled_bit=0 ";
            if (!string.IsNullOrEmpty(CompanyList))
            {
                condition += " AND LadeAssignment_T.CompanyID_int IN ( " + CompanyList + " ) ";
            }
            if (!string.IsNullOrEmpty(LaderTypeList))
            {
                condition += " AND Traffic_T.LaderTypeID_int IN ( " + LaderTypeList + " ) ";
            }
            if (!string.IsNullOrEmpty(NumberPlate_nvc) && (!string.IsNullOrEmpty(SerialPlate_nvc)))
            {
                condition += " AND Traffic_T.NumberPlate_nvc = '" + NumberPlate_nvc + "'  AND Traffic_T.SerialPlate_nvc =" + SerialPlate_nvc;
            }
            if (!string.IsNullOrEmpty(CarCardNumber_nvc))
            {
                condition += " AND Traffic_T.CarCardNumber_nvc = " + CarCardNumber_nvc;
            }
            if (!string.IsNullOrEmpty(DriverCardNumber_nvc))
            {
                condition += " AND Traffic_T.DriverCardNumber_nvc = " + DriverCardNumber_nvc;
            }
            if (!string.IsNullOrEmpty(OrderColumns))
            {
                condition += " ORDER BY " + OrderColumns;
            }
            else
            {
                condition += " ORDER BY LadBillCreditID_int ";
            }
            DataTable LadBillCreditDataTable = new DataTable();

            LadBillFactory.GetAllWithTrafficLadBillCreditByConditon(condition, ref LadBillCreditDataTable);
            Fillfields(LadBillCreditDataTable);
            FromDatetxt.Text = FromDate;
            ToDatetxt.Text   = ToDate;
            DateTextBox.Text = LadBillFactory.ServerJalaliDate;
            TimeTextBox.Text = LadBillFactory.ServerTime;
        }
コード例 #9
0
        public override bool Validate(params object[] value)
        {
            try
            {
                this.Description = string.Empty;
                if (value.Length != Field.Length)
                {
                    this.Description = Hepsa.Core.My.Resources.ValidationMessage.IncorrectDataType;
                    return(false);
                }
                Int64?LadeAssignmentID_bint = (Int64?)value[0];
                int?  Count_int             = (int?)value[1];

                if (LadeAssignmentID_bint.HasValue == false || Count_int.HasValue == false || Count_int == 0)
                {
                    return(true);
                }

                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                string condition = string.Format(" LadBillCredit_T.LadeAssignmentID_bint={0} AND Canceled_bit=0", LadeAssignmentID_bint);
                List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T> LadBillCreditList = LadBillCreditFactory.GetAllByCondition(condition);
                int LadBillCreditCount = 0;
                if (LadBillCreditList != null && LadBillCreditList.Count > 0)
                {
                    LadBillCreditCount = LadBillCreditList.Count;
                }

                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys    LadeAssignmentKey     = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys();
                LadeAssignmentKey.LadeAssignmentID_bint = LadeAssignmentID_bint;
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKey);

                if (LadeAssignmentEntity != null)
                {
                    if (LadeAssignmentEntity.CarCount_int - LadBillCreditCount < Count_int)
                    {
                        this.Description = string.Format(Hepsa.Core.My.Resources.ValidationMessage.ValueShouldNotGreater, "تعداد ماشین حذفی", LadeAssignmentEntity.CarCount_int - LadBillCreditCount);
                        return(false);
                    }
                }
                return(true);
            }
            catch (System.Exception ex)
            {
                this.Description = ex.Message;
                return(false);
            }
        }
コード例 #10
0
        private void LoadLadBillCreditGrid()
        {
            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
            DataTable LadeAssignmentDataTable = new DataTable();

            try
            {
                //LadBillCreditFactory.GetActives(ref LadeAssignmentDataTable);
                LadBillFactory.GetAllWithTrafficLadBillCredit(ref LadeAssignmentDataTable, LadBillFactory.ServerJalaliDate);
                this.LadBillWithTrafficGridView.DataSource = LadeAssignmentDataTable;
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
コード例 #11
0
 private void AllLadBilltoolStripButton_Click(object sender, EventArgs e)
 {
     try
     {
         HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
         DataTable LadeAssignmentDataTable = new DataTable();
         LadBillFactory.GetAllWithTrafficLadBillCredit(ref LadeAssignmentDataTable, null);
         LadBillWithTrafficGridView.Visible         = true;
         stiViewerControl1.Visible                  = false;
         this.LadBillWithTrafficGridView.DataSource = LadeAssignmentDataTable;
     }
     catch (System.Exception ex)
     {
         Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
     }
 }
コード例 #12
0
        private void AllLadeBilltoolStripButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
            DataTable LadeAssignmentDataTable = new DataTable();

            try
            {
                this.LadBillWithTrafficGridView.SelectionChanged -= new System.EventHandler(this.LadBillWithTrafficGridView_SelectionChanged);
                LadBillFactory.GetAllWithTrafficLadBillCredit(ref LadeAssignmentDataTable, null);
                this.LadBillWithTrafficGridView.DataSource        = LadeAssignmentDataTable;
                this.LadBillWithTrafficGridView.SelectionChanged += new System.EventHandler(this.LadBillWithTrafficGridView_SelectionChanged);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
コード例 #13
0
 private void LoadAllLadBill()
 {
     try
     {
         HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
         FromDatefaDatePicker.SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(LadBillFactory.ServerJalaliDate);
         ToDatefaDatePicker.SelectedDateTime   = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(LadBillFactory.ServerJalaliDate);
         DataTable LadeAssignmentDataTable = new DataTable();
         LadBillFactory.GetAllWithTrafficLadBillCredit(ref LadeAssignmentDataTable, LadBillFactory.ServerJalaliDate);
         LadBillWithTrafficGridView.Visible         = true;
         stiViewerControl1.Visible                  = false;
         this.LadBillWithTrafficGridView.DataSource = LadeAssignmentDataTable;
     }
     catch (System.Exception ex)
     {
         Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
     }
 }
コード例 #14
0
        private void Search()
        {
            try
            {
                LadBillWithTrafficGridView.DataSource = null;

                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                DataTable LadeBillCreditDataTable = new DataTable();
                try
                {
                    string Condition = string.Empty;
                    if (!string.IsNullOrEmpty(TrafficNumberTextBox.Text))
                    {
                        Condition = string.Format(" Traffic_T.TrafficNumber_bint={0}", TrafficNumberTextBox.Text);
                    }
                    else if (!string.IsNullOrEmpty(AcceptedTurnNumberTextBox.Text))
                    {
                        Condition = string.Format(" Traffic_T.AcceptedTurnNumber_bint={0}", AcceptedTurnNumberTextBox.Text);
                    }
                    else if (!string.IsNullOrEmpty(NumberPlate_nvcTextBox.Text) && !string.IsNullOrEmpty(SerialPlate_nvcTextBox.Text))
                    {
                        Condition = string.Format(" Traffic_T.NumberPlate_nvc='{0}' AND Traffic_T.SerialPlate_nvc='{1}' ", NumberPlate_nvcTextBox.Text, SerialPlate_nvcTextBox.Text);
                    }
                    else if (!string.IsNullOrEmpty(LadBillCreditTextBox.Text))
                    {
                        Condition = string.Format(" LadBillCredit_T.LadBillCreditID_int={0}", LadBillCreditTextBox.Text);
                    }
                    else if (!string.IsNullOrEmpty(LadeAssignmentIDTextBox.Text))
                    {
                        Condition = string.Format(" LadeAssignment_T.LadeAssignmentID_bint={0}", LadeAssignmentIDTextBox.Text);
                    }
                    LadBillFactory.GetAllWithTrafficLadBillCreditByConditon(Condition, ref LadeBillCreditDataTable);
                    this.LadBillWithTrafficGridView.DataSource = LadeBillCreditDataTable;
                }
                catch (System.Exception ex)
                {
                    Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
                }
            }
            catch (System.Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #15
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            try
            {
                bool CanNotChangeCount = false;
                BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory  LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LadeAssignmentKey     = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys();
                LadeAssignmentKey.LadeAssignmentID_bint = (Int64?)this.LadeAssignmentGridView.CurrentRow.Cells["colLadeAssignmentID_bint"].Value;
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T LadeAssignmentEntity = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T();
                LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKey);
                if (LadeAssignmentEntity.Accepted_bit == true)
                {
                    ///Select ladbillcredit
                    HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                    string condition = "LadBillCredit_T.LadeAssignmentID_bint='" + Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64) + "' or (LadBillCredit_T.LadBillCreditID_int is not null and LadBillCredit_T.Canceled_bit=0 AND LadBillCredit_T.Turn_bit is not NULL) order by [LadBillCredit_T].[LadBillCreditID_int] desc";
                    List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T> LadBillCreditList = LadBillCreditFactory.GetAllByCondition(condition);
                    ///Select canceleced
                    HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory LadeCancelFactory = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory();
                    List <HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T> LadeCancelList    = new List <HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T>();
                    LadeCancelList = LadeCancelFactory.GetAllByCondition(string.Format("LadeCancelAssignment_T.LadeAssignmentID_bint={0} order by [LadeCancelAssignment_T].[LadeCancelAssignmentID_int] desc", Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64)));
                    ///select Remained
                    DataTable remainedLadeAssignmentTable = new DataTable();
                    string    RemainedCondition           = string.Format("LadeAssignmentID_bint={0}", Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64));
                    LadeAssignmentFactory.SelectRemainedDetailSelectByCondition(RemainedCondition, remainedLadeAssignmentTable);
                    int remaindCount_int = 0;
                    if (remainedLadeAssignmentTable != null && remainedLadeAssignmentTable.Rows.Count > 0)
                    {
                        remaindCount_int = (Int32)remainedLadeAssignmentTable.Rows[remainedLadeAssignmentTable.Rows.Count - 1]["RemainderCount_int"];
                    }

                    if (LadeCancelList != null && LadeCancelList.Count > 0)
                    {
                        if (LadeCancelList[0].Count_int != null && remaindCount_int == 0)
                        {
                            throw new ApplicationException("این اطلاع رسانی باطل شده است  و تعداد مانده ها صفر می باشد");
                        }
                        else
                        {
                            CanNotChangeCount = true;
                        }
                    }

                    if (remaindCount_int == 0)
                    {
                        throw new ApplicationException("بار مورد نظر مجوز گرفته است");
                    }
                    else
                    {
                        CanNotChangeCount = true;
                    }

                    HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_TFactory LadeAssignmentCacelRequestFactory = new HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_TFactory();
                    DataTable LadeAssignmentCacelRequestDataTable = new DataTable();
                    LadeAssignmentCacelRequestFactory.GetAllBy(HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_T.LadeAssignmentCacelRequest_TField.LadeAssignmentID_bint, LadeAssignmentKey.LadeAssignmentID_bint, ref LadeAssignmentCacelRequestDataTable);

                    if (!(LadeAssignmentCacelRequestDataTable != null && LadeAssignmentCacelRequestDataTable.Rows.Count > 0 && HPS.Common.CurrentUser.user.CompanyID_int.HasValue == false))
                    {
                        throw new ApplicationException("این اطلاع رسانی بار تأیید شده است و قابل تغییر نمی باشد");
                    }

                    if (string.IsNullOrEmpty(LadeAssignmentCacelRequestDataTable.Rows[0]["AcceptedDate_nvc"].ToString()))
                    {
                        throw new ApplicationException("درخواست انصراف یا اعمال تغییرات قبول نشده است");
                    }
                }
                LadeAssignmentInforming LadeAssignment = new LadeAssignmentInforming(BaseEntityForm1.enmState.Edit, (DataTable)this.LadeAssignmentGridView.DataSource, LadeAssignmentKey, CanNotChangeCount);
                LadeAssignment.ShowDialog();
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #16
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
            HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_TFactory LadBillCreditCancelCommentFactory = new HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_TFactory();

            try
            {
                if (LadBillCreditCancelCommentID_intCheckedListBox.CheckedItems.Count == 0)
                {
                    throw new ApplicationException("توضیحات ابطال مجوز انتخاب نشده است");
                }

                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T LadBillCreditEntity = LadBillCreditFactory.GetBy(this._Key);
                HPS.BLL.TrafficBLL.BLLTraffic_TFactory      TrafficFactory      = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                if (LadBillCreditEntity == null)
                {
                    throw new HPS.Exceptions.LadBillCreditNotFound();
                }
                LadBillCreditEntity.Canceled_bit         = true;
                LadBillCreditEntity.CanceledComment_nvc  = this.LadBillCreditCancelComment_nvcTextBox.Text;
                LadBillCreditEntity.CanceledDate_nvc     = LadBillCreditFactory.ServerJalaliDate;
                LadBillCreditEntity.CanceledTime_nvc     = LadBillCreditFactory.ServerTime;
                LadBillCreditEntity.CanceledUserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc;
                if (TurnLeftRadioButton.Checked == true)
                {
                    LadBillCreditEntity.Turn_bit = true;
                }
                else if (TurnCancelRadioButton.Checked == true)
                {
                    LadBillCreditEntity.Turn_bit = false;
                }
                if (LadBillCreditEntity.Turn_bit.HasValue == false)
                {
                    throw new ApplicationException("وضعیت نوبت را تعیین نمایید ");
                }
                if (LadeAssignmentLeftradioButton.Checked == false && LadeAssginmentCancelradioButton.Checked == false && OtherRemainedCancelRadioButton.Checked == false)
                {
                    throw new ApplicationException("وضعیت اطلاع رسانی را تعیین نمایید ");
                }
                string    strSelect = string.Format("TrafficID_bint='{0}'", _TrafficKey.TrafficID_bint);
                DataRow[] drSelect  = _dataTable.Select(strSelect);
                DataTable TrafficStatusDataTable = new DataTable();
                if (drSelect != null && drSelect.Length > 0)
                {
                    LadBillCreditFactory.GetLastStatusForCancelLadBillCredit((string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["NumberPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["SerialPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["CarCardNumber_nvc"], TypeCode.String), TrafficStatusDataTable);
                }
                if (TrafficStatusDataTable != null && TrafficStatusDataTable.Rows.Count > 0)
                {
                    bool? HasTurn_bit             = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["HasTurn_bit"], TypeCode.Boolean);
                    bool? TurnReturn_bit          = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TurnReturn_bit"], TypeCode.Boolean);
                    bool? TurnCanceled_bit        = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TurnCanceled_bit"], TypeCode.Boolean);
                    bool? HasLadBillCredit_bit    = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["HasLadBillCredit_bit"], TypeCode.Boolean);
                    bool? LadBillCreditCancel_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["LadBillCreditCancel_bit"], TypeCode.Boolean);
                    bool? LadBillCreditTurn_bit   = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["LadBillCreditTurn_bit"], TypeCode.Boolean);
                    bool? TurnAccepted_bit        = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TurnAccepted_bit"], TypeCode.Boolean);
                    Int64?AcceptedTurnNumber_bint = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["AcceptedTurnNumber_bint"], TypeCode.Int64);
                    //  DateTime TrafficDate = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(TrafficEntity.Date_nvc)).MyDate.ToString("yyyy/MM/dd") + " " + TrafficEntity.Time_nvc);

                    #region  Conditions
                    if ((Int32)drSelect[0]["ServiceID_int"] == 2)
                    {
                        if (TrafficStatusDataTable != null && TrafficStatusDataTable.Rows.Count > 0)
                        {
                            if (HasTurn_bit.HasValue == false || HasTurn_bit == true)
                            {
                                if (TurnAccepted_bit.HasValue && TurnAccepted_bit == true)
                                {
                                    if (TurnCanceled_bit.HasValue && TurnCanceled_bit == true)
                                    {
                                        throw new ApplicationException("این نوبت باطل شده است");
                                    }
                                    else
                                    {
                                        if (HasLadBillCredit_bit.HasValue && HasLadBillCredit_bit == true)
                                        {
                                            if (LadBillCreditCancel_bit.HasValue && LadBillCreditCancel_bit == false)
                                            {
                                                if (LadBillCreditTurn_bit.HasValue && LadBillCreditTurn_bit == true)
                                                {
                                                    //محاسبه مدت مجاز سفر
                                                    DateTime  NowDate          = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(TrafficFactory.ServerJalaliDate)).MyDate.ToString("yyyy/MM/dd") + " " + TrafficFactory.ServerTime);
                                                    DataTable TrafficDataTable = new DataTable();
                                                    if (TrafficDataTable != null && TrafficDataTable.Rows.Count > 0)
                                                    {
                                                        Int32 _CityTravelHour = 0;
                                                        if (!string.IsNullOrEmpty(TrafficDataTable.Rows[0]["TravelTime_int"].ToString()))
                                                        {
                                                            _CityTravelHour = Convert.ToInt32(TrafficDataTable.Rows[0]["TravelTime_int"].ToString());
                                                        }
                                                        ///////////////
                                                        string   _OutDate = TrafficDataTable.Rows[0]["Date_nvc"].ToString();
                                                        string   _OutTime = TrafficDataTable.Rows[0]["Time_nvc"].ToString();
                                                        DateTime OutDate  = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(_OutDate)).MyDate.ToString("yyyy/MM/dd") + " " + _OutTime);

                                                        if (TrafficDataTable.Rows[0]["Out_bit"].ToString() == "False")
                                                        {
                                                            TimeSpan date = NowDate - OutDate;
                                                            if (date.TotalHours < _CityTravelHour)
                                                            {
                                                                throw new ApplicationException("مدت مجاز سفر برای این کامیون تمام نشده است و امکان ادامه عملیات ممکن نیست");
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    if (TurnLeftRadioButton.Checked)
                                                    {
                                                        DataTable TurnStatusDataTable = new DataTable();
                                                        //*************اگر خودرو خارج شده باشد اجازه حفظ نوبت را نداشته باشد93/06/10
                                                        List <HPS.BLL.TrafficBLL.BLLTraffic_T> TrafficList = TrafficFactory.GetAllBy(HPS.BLL.TrafficBLL.BLLTraffic_T.Traffic_TField.TrafficNumber_bint, drSelect[0]["TrafficNumber_bint"]);
                                                        if (TrafficList.Count > 0 && TrafficList != null)
                                                        {
                                                            foreach (HPS.BLL.TrafficBLL.BLLTraffic_T item in TrafficList)
                                                            {
                                                                if (item.Out_bit == true)
                                                                {
                                                                    //LadBillCreditEntity.Turn_bit = false;
                                                                    Hepsa.Core.Common.MessageBox.InformationMessage("این خودرو خارج شده است، امکان حفظ نوبت وجود ندارد");
                                                                    return;
                                                                }
                                                            }
                                                        }


                                                        //BLL.SettingsBLL.BLLSetting_TKeys SettingKey = new BLL.SettingsBLL.BLLSetting_TKeys();
                                                        //BLL.SettingsBLL.BLLSetting_T SettingEntity = new BLL.SettingsBLL.BLLSetting_T();
                                                        //BLL.SettingsBLL.BLLSetting_TFactory SettingsFactory = new BLL.SettingsBLL.BLLSetting_TFactory();
                                                        //SettingKey.SettingID_int = 1009;
                                                        //SettingEntity = SettingsFactory.GetBy(SettingKey);
                                                        //TrafficFactory.SelectActiveTurnsForInTraffic(drSelect[0]["NumberPlate_nvc"].ToString(), drSelect[0]["SerialPlate_nvc"].ToString(), SettingEntity.Value_nvc, "00:00:00", TrafficFactory.ServerJalaliDate, "23:59:59", TurnStatusDataTable);

                                                        TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["NumberPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["SerialPlate_nvc"], TypeCode.String), TurnStatusDataTable);
                                                        if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0)
                                                        {
                                                            if ((bool?)(Hepsa.Core.Common.PersentationController.GetEntityValue(TurnStatusDataTable.Rows[0]["Canceled_bit"], TypeCode.Boolean)) != false)
                                                            {
                                                                throw new ApplicationException(string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[0]["AcceptedTurnNumber_bint"]));
                                                            }
                                                        }
                                                        DataTable LadBillCreditTrafficStatusDataTable = new DataTable();
                                                        LadBillCreditFactory.GetLadBillCreditTrafficStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["NumberPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["SerialPlate_nvc"], TypeCode.String), LadBillCreditTrafficStatusDataTable);
                                                        if (LadBillCreditTrafficStatusDataTable != null && LadBillCreditTrafficStatusDataTable.Rows.Count > 0)
                                                        {
                                                            int? LadBillCredit     = (int?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillCreditTrafficStatusDataTable.Rows[0]["LadBillCreditID_int"], TypeCode.Int32);
                                                            int? TurnCancelComment = (int?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillCreditTrafficStatusDataTable.Rows[0]["TurnCancelCommantID_int"], TypeCode.Int32);
                                                            bool?Turnaccepted      = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillCreditTrafficStatusDataTable.Rows[0]["Turnaccepted_bit"], TypeCode.Boolean);


                                                            string    strHas2LadBill  = string.Format("TrafficID_bint='{0}'", drSelect[0]["TrafficID_bint"]);
                                                            string    strSecondStatus = string.Format("TrafficID_bint>'{0}'", drSelect[0]["TrafficID_bint"]);
                                                            DataRow[] drHas2LadBill   = LadBillCreditTrafficStatusDataTable.Select(strHas2LadBill);
                                                            DataRow[] drSecondStatus  = LadBillCreditTrafficStatusDataTable.Select(strSecondStatus);
                                                            if (drHas2LadBill != null && drHas2LadBill.Length > 0)
                                                            {
                                                                if (drSecondStatus != null && drSecondStatus.Length > 0)
                                                                {
                                                                    int? LadBillCreditSecond     = (int?)Hepsa.Core.Common.PersentationController.GetEntityValue(drSecondStatus[0]["LadBillCreditID_int"], TypeCode.Int32);
                                                                    int? TurnCancelCommentSecond = (int?)Hepsa.Core.Common.PersentationController.GetEntityValue(drSecondStatus[0]["TurnCancelCommantID_int"], TypeCode.Int32);
                                                                    bool?TurnacceptedSecond      = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(drSecondStatus[0]["Turnaccepted_bit"], TypeCode.Boolean);
                                                                    if (TurnacceptedSecond.HasValue && TurnacceptedSecond == true)
                                                                    {
                                                                        if (LadBillCreditSecond.HasValue)
                                                                        {
                                                                            throw new ApplicationException(string.Format("این ناوگان به شماره نوبت< {0} >و شماره قبض< {1} >مجوز گرفته است", drSecondStatus[0]["AcceptedTurnNumber_bint"], drSecondStatus[0]["TrafficNumber_bint"]));
                                                                        }
                                                                        else
                                                                        {
                                                                            if (TurnCancelCommentSecond.HasValue == false)
                                                                            {
                                                                                throw new ApplicationException(string.Format("این ناوگان داراي شماره نوبت تأييد شده< {0} >مي باشد", drSecondStatus[0]["AcceptedTurnNumber_bint"], drSecondStatus[0]["TrafficNumber_bint"]));
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                DataTable TurnTtatusDataTable = new DataTable();
                                                                TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["NumberPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["SerialPlate_nvc"], TypeCode.String), TurnTtatusDataTable);
                                                                if (TurnTtatusDataTable != null && TurnTtatusDataTable.Rows.Count > 0)
                                                                {
                                                                    if ((bool?)(Hepsa.Core.Common.PersentationController.GetEntityValue(TurnStatusDataTable.Rows[0]["Canceled_bit"], TypeCode.Boolean)) != false)
                                                                    {
                                                                        throw new ApplicationException(string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[0]["AcceptedTurnNumber_bint"]));
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (TurnCancelRadioButton.Checked == true)
                                                        {
                                                            LadBillCreditEntity.Turn_bit = false;
                                                            //*************اگر خودرو خارج نشده باشد اجازه ابطال را نداشته باشد94/10/01
                                                            List <HPS.BLL.TrafficBLL.BLLTraffic_T> TrafficOutList = TrafficFactory.GetAllByCondition(string.Format("[Traffic_T].Out_bit=1 and [Traffic_T].TrafficNumber_bint={0}", drSelect[0]["TrafficNumber_bint"].ToString()));
                                                            if (TrafficOutList.Count == 0)
                                                            {
                                                                Hepsa.Core.Common.MessageBox.InformationMessage("این خودرو خارج نشده است، امکان ابطال وجود ندارد");
                                                                return;
                                                            }
                                                        }
                                                        //ابطال نوبت
                                                        HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
                                                        HPS.BLL.TurnManagementBLL.BLLTurnManagement_T        TurnManagementEntity  = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_T();
                                                        TurnManagementEntity.TurnCancelCommantID_int = 11;
                                                        TurnManagementEntity.TurnCancelCommment_nvc  = "ابطال نوبت هنگام ابطال مجوز";
                                                        TurnManagementEntity.Return_bit     = false;
                                                        TurnManagementEntity.Date_nvc       = TurnManagementFactory.ServerJalaliDate;
                                                        TurnManagementEntity.Time_nvc       = TurnManagementFactory.ServerTime;
                                                        TurnManagementEntity.UserName_nvc   = HPS.Common.CurrentUser.user.UserName_nvc;
                                                        TurnManagementEntity.TrafficID_bint = (Int64?)drSelect[0]["TrafficID_bint"];
                                                        TurnManagementFactory.Insert(TurnManagementEntity);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                DataTable TurnStatusDataTable = new DataTable();
                                                TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["NumberPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["SerialPlate_nvc"], TypeCode.String), TurnStatusDataTable);
                                                if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0)
                                                {
                                                    throw new ApplicationException(string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[TurnStatusDataTable.Rows.Count - 1]["AcceptedTurnNumber_bint"]));
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (TurnLeftRadioButton.Checked)
                                            {
                                                throw new ApplicationException(string.Format("این ناوگان دارای شماره نوبت تأیید شده {0} می باشد ومجوز نگرفته است", AcceptedTurnNumber_bint));
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    DataTable TrafficStatusForAcceptTurnDataTable = new DataTable();
                                    TrafficFactory.GetLastStatusForAcceptTurn((Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["TrafficID_bint"], TypeCode.Int64), TrafficStatusForAcceptTurnDataTable);
                                    if (TrafficStatusForAcceptTurnDataTable != null && TrafficStatusForAcceptTurnDataTable.Rows.Count > 0)
                                    {
                                        throw new ApplicationException(string.Format("این ناوگان دارای شماره نوبت تأیید شده {0} می باشد ومجوز نگرفته است", TrafficStatusForAcceptTurnDataTable.Rows[0]["AcceptedTurnNumber_bint"]));
                                    }
                                }
                            }
                        }
                        else
                        {
                            throw new ApplicationException("نوبت معتبر ندارد");
                        }
                    }
                    #endregion
                }



                LadBillCreditFactory.BeginProc();

                if (LadeAssginmentCancelradioButton.Checked)
                {
                    //ابطال اطلاع رسانی بار

                    LadBillCreditFactory.Update(LadBillCreditEntity, this._Key);
                    HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory LadeCancelAssignmentFactory = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory();
                    HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T        LadeCancelAssignmentEntity  = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T();
                    LadeCancelAssignmentEntity.LadeAssignmentID_bint   = _LaKey.LadeAssignmentID_bint.Value;
                    LadeCancelAssignmentEntity.LadeCancelCommentID_int = 6;
                    LadeCancelAssignmentEntity.LadeCancelComment_nvc   = "ابطال اطلاع رسانی بار هنگام ابطال مجوز";
                    LadeCancelAssignmentEntity.Count_int    = 1;
                    LadeCancelAssignmentEntity.Date_nvc     = LadeCancelAssignmentFactory.ServerJalaliDate;
                    LadeCancelAssignmentEntity.Time_nvc     = LadeCancelAssignmentFactory.ServerTime;
                    LadeCancelAssignmentEntity.UserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc;
                    LadeCancelAssignmentFactory.Insert(LadeCancelAssignmentEntity);
                }

                else if (OtherRemainedCancelRadioButton.Checked)
                {
                    //ابطال اطلاع رسانی بار و باقی  مانده ها
                    HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory LadeCancelAssignmentFactory = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory();
                    HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T        LadeCancelAssignmentEntity  = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T();
                    BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
                    DataTable remainedLadeAssignmentTable = new DataTable();
                    string    condition = string.Format("LadeAssignmentID_bint={0}", _LaKey.LadeAssignmentID_bint.Value);
                    LadeAssignmentFactory.SelectRemainedDetailSelectByCondition(condition, remainedLadeAssignmentTable);
                    int remaindCount_int = 0;
                    if (remainedLadeAssignmentTable != null && remainedLadeAssignmentTable.Rows.Count > 0)
                    {
                        remaindCount_int = (Int32)remainedLadeAssignmentTable.Rows[remainedLadeAssignmentTable.Rows.Count - 1]["RemainderCount_int"];
                    }
                    LadBillCreditFactory.Update(LadBillCreditEntity, this._Key);
                    LadeCancelAssignmentEntity.LadeAssignmentID_bint   = _LaKey.LadeAssignmentID_bint.Value;
                    LadeCancelAssignmentEntity.LadeCancelCommentID_int = 6;
                    LadeCancelAssignmentEntity.LadeCancelComment_nvc   = "ابطال اطلاع رسانی بار هنگام ابطال مجوز";
                    LadeCancelAssignmentEntity.Count_int    = remaindCount_int + 1;
                    LadeCancelAssignmentEntity.Date_nvc     = LadeCancelAssignmentFactory.ServerJalaliDate;
                    LadeCancelAssignmentEntity.Time_nvc     = LadeCancelAssignmentFactory.ServerTime;
                    LadeCancelAssignmentEntity.UserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc;
                    LadeCancelAssignmentFactory.Insert(LadeCancelAssignmentEntity);
                }
                else
                {
                    LadBillCreditFactory.Update(LadBillCreditEntity, this._Key);
                }

                //ابطال مجوز

                for (int index = 0; index < this.LadBillCreditCancelCommentID_intCheckedListBox.CheckedItems.Count; index++)
                {
                    HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_T LadBillCreditCancelCommentEntity = new HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_T();
                    LadBillCreditCancelCommentEntity.LadBillCreditID_int        = this._Key.LadBillCreditID_int;
                    LadBillCreditCancelCommentEntity.LadBillCancelCommentID_int = ((HPS.BLL.LadBillCancelCommentBLL.BLLLadBillCancelComment_T) this.LadBillCreditCancelCommentID_intCheckedListBox.CheckedItems[index]).LadBillCancelCommentID_int;
                    LadBillCreditCancelCommentEntity.LadbillCancelComment_nvc   = ((HPS.BLL.LadBillCancelCommentBLL.BLLLadBillCancelComment_T) this.LadBillCreditCancelCommentID_intCheckedListBox.CheckedItems[index]).LadbillCancelComment_nvc;
                    LadBillCreditCancelCommentFactory.Insert(LadBillCreditCancelCommentEntity);
                }

                LadBillCreditFactory.CommitProc();

                if (this._dataTable != null)
                {
                    DataRow[] dr = this._dataTable.Select(string.Format("LadBillCreditID_int = {0}", this._Key.LadBillCreditID_int));
                    if (dr != null && dr.Length > 0)
                    {
                        dr[0]["Canceled_bit"] = true;
                    }
                    this._dataTable.AcceptChanges();
                }
                this.Close();
            }
            catch (Exception ex)
            {
                LadBillCreditFactory.RollBackProc();
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #17
0
        private void FillCombo()
        {
            try
            {
                HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeID_intFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
                DataTable LaderTypeID_intDataTable = new DataTable();
                string    laderCondition           = "[LaderType_T].[Active_bit]='true'";
                LaderTypeID_intFactory.GetAllByCondition(laderCondition, ref LaderTypeID_intDataTable);
                this.LaderTypecheckedComboBox.DropDownDataSource    = LaderTypeID_intDataTable;
                this.LaderTypecheckedComboBox.DropDownDataMember    = "LaderType_T";
                this.LaderTypecheckedComboBox.DropDownDisplayMember = HPS.BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.LaderType_nvc.ToString();
                this.LaderTypecheckedComboBox.DropDownValueMember   = HPS.BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.LaderTypeID_int.ToString();
                LaderTypecheckedComboBox.RetrieveStructure();
                LaderTypecheckedComboBox.DropDownList.Columns[1].Visible  = false;
                LaderTypecheckedComboBox.DropDownList.Columns[2].Visible  = false;
                LaderTypecheckedComboBox.DropDownList.Columns[4].Visible  = false;
                LaderTypecheckedComboBox.DropDownList.Columns[3].Caption  = "بارگیر";
                LaderTypecheckedComboBox.DropDownList.Columns[3].Width    = 300;
                LaderTypecheckedComboBox.DropDownList.Columns[5].Visible  = false;
                LaderTypecheckedComboBox.DropDownList.Columns[6].Visible  = false;
                LaderTypecheckedComboBox.DropDownList.Columns[7].Visible  = false;
                LaderTypecheckedComboBox.DropDownList.Columns[8].Visible  = false;
                LaderTypecheckedComboBox.DropDownList.Columns[9].Visible  = false;
                LaderTypecheckedComboBox.DropDownList.Columns[10].Visible = false;


                HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyID_intFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory();
                DataTable CompanyID_intDataTable = new DataTable();
                string    CompanyCondition       = "[Company_T].[Active_bit]='true'";
                CompanyID_intFactory.GetAllByCondition(CompanyCondition, ref CompanyID_intDataTable);
                DataRow Companydr = CompanyID_intDataTable.NewRow();
                //Companydr["CompanyID_int"] = 0;
                //CompanyID_intDataTable.Rows.InsertAt(Companydr, 0);
                this.CompanyID_intcheckedComboBox.DropDownDataSource    = CompanyID_intDataTable;
                this.CompanyID_intcheckedComboBox.DropDownDataMember    = "Company_T";
                this.CompanyID_intcheckedComboBox.DropDownDisplayMember = HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Company_nvc.ToString();
                this.CompanyID_intcheckedComboBox.DropDownValueMember   = HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyID_int.ToString();
                CompanyID_intcheckedComboBox.RetrieveStructure();
                CompanyID_intcheckedComboBox.DropDownList.Columns[1].Visible  = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[2].Visible  = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[4].Visible  = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[3].Caption  = "شرکت";
                CompanyID_intcheckedComboBox.DropDownList.Columns[3].Width    = 300;
                CompanyID_intcheckedComboBox.DropDownList.Columns[5].Visible  = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[6].Visible  = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[7].Visible  = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[8].Visible  = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[9].Visible  = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[10].Visible = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[11].Visible = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[12].Visible = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[13].Visible = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[14].Visible = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[15].Visible = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[16].Visible = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[17].Visible = false;
                CompanyID_intcheckedComboBox.DropDownList.Columns[18].Visible = false;


                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                DataTable LadbillOrder1Table = new DataTable();
                LadBillCreditFactory.SelectLadBillCreditOrderColumn(LadbillOrder1Table);
                DataRow emptyRow1 = LadbillOrder1Table.NewRow();
                LadbillOrder1Table.Rows.InsertAt(emptyRow1, 0);
                this.Order1ComboBox.DisplayMember = "PropertyValue";
                this.Order1ComboBox.ValueMember   = "ColumnName";
                this.Order1ComboBox.DataSource    = LadbillOrder1Table;
                this.Order1ComboBox.SelectedIndex = 0;

                DataTable LadbillOrder2Table = new DataTable();
                LadBillCreditFactory.SelectLadBillCreditOrderColumn(LadbillOrder2Table);
                DataRow emptyRow2 = LadbillOrder2Table.NewRow();
                LadbillOrder2Table.Rows.InsertAt(emptyRow2, 0);
                this.Order2ComboBox.DisplayMember = "PropertyValue";
                this.Order2ComboBox.ValueMember   = "ColumnName";
                this.Order2ComboBox.DataSource    = LadbillOrder2Table;
                this.Order2ComboBox.SelectedIndex = 0;

                DataTable LadbillOrder3Table = new DataTable();
                LadBillCreditFactory.SelectLadBillCreditOrderColumn(LadbillOrder3Table);
                DataRow emptyRow3 = LadbillOrder3Table.NewRow();
                LadbillOrder3Table.Rows.InsertAt(emptyRow3, 0);
                this.Order3ComboBox.DisplayMember = "PropertyValue";
                this.Order3ComboBox.ValueMember   = "ColumnName";
                this.Order3ComboBox.DataSource    = LadbillOrder3Table;
                this.Order3ComboBox.SelectedIndex = 0;

                DataTable LadbillOrder4Table = new DataTable();
                LadBillCreditFactory.SelectLadBillCreditOrderColumn(LadbillOrder4Table);
                DataRow emptyRow4 = LadbillOrder4Table.NewRow();
                LadbillOrder4Table.Rows.InsertAt(emptyRow4, 0);
                this.Order4ComboBox.DisplayMember = "PropertyValue";
                this.Order4ComboBox.ValueMember   = "ColumnName";
                this.Order4ComboBox.DataSource    = LadbillOrder4Table;
                this.Order4ComboBox.SelectedIndex = 0;

                DataTable LadbillOrder5Table = new DataTable();
                LadBillCreditFactory.SelectLadBillCreditOrderColumn(LadbillOrder5Table);
                DataRow emptyRow5 = LadbillOrder5Table.NewRow();
                LadbillOrder5Table.Rows.InsertAt(emptyRow5, 0);
                this.Order5ComboBox.DisplayMember = "PropertyValue";
                this.Order5ComboBox.ValueMember   = "ColumnName";
                this.Order5ComboBox.DataSource    = LadbillOrder5Table;
                this.Order5ComboBox.SelectedIndex = 0;

                HPS.BLL.TrafficBLL.BLLTraffic_TFactory Factory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                this.FromDatefaDatePicker.SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(Factory.ServerJalaliDate);
                this.ToDatefaDatePicker.SelectedDateTime   = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(Factory.ServerJalaliDate);
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #18
0
        private void ShowButton_Click(object sender, EventArgs e)
        {
            try
            {
                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                DataTable LadBillCreditDataTable = new DataTable();
                if (FromDatefaDatePicker.IsNull)
                {
                    throw new ApplicationException("از تاریخ خالی است");
                }
                else if (ToDatefaDatePicker.IsNull)
                {
                    throw new ApplicationException("تا تاریخ خالی است");
                }
                Hepsa.Core.Validation.DateRule <string> FromDateValidator = new Hepsa.Core.Validation.DateRule <string>("FromDate", "از تاریخ", null, null);
                if (FromDateValidator.Validate(Hepsa.Core.Common.PersentationController.GetEntityValue(FromDatefaDatePicker.Text, TypeCode.String).ToString()) == false)
                {
                    throw new ApplicationException(FromDateValidator.Description);
                }

                Hepsa.Core.Validation.DateRule <string> ToDateValidator = new Hepsa.Core.Validation.DateRule <string>("ToDate", "تا تاریخ", null, null);
                if (ToDateValidator.Validate(Hepsa.Core.Common.PersentationController.GetEntityValue(ToDatefaDatePicker.Text, TypeCode.String).ToString()) == false)
                {
                    throw new ApplicationException(ToDateValidator.Description);
                }

                ///Select Company and LaderType
                object[] CompanyList     = new object[300];
                string   CompanyList_nvc = string.Empty;
                int      index           = 0;
                CompanyList = CompanyID_intcheckedComboBox.CheckedValues;
                if (CompanyList != null)
                {
                    foreach (object obj in CompanyList)
                    {
                        CompanyList_nvc = string.Format("{0},{1}", CompanyList_nvc, CompanyList[index].ToString());
                        index          += 1;
                    }
                    CompanyList_nvc = CompanyList_nvc.Substring(1, CompanyList_nvc.Length - 1);
                }

                object[] LaderTypeList     = new object[300];
                string   LaderTypeList_nvc = string.Empty;
                index         = 0;
                LaderTypeList = LaderTypecheckedComboBox.CheckedValues;
                if (LaderTypeList != null)
                {
                    foreach (object obj in LaderTypeList)
                    {
                        LaderTypeList_nvc = string.Format("{0},{1}", LaderTypeList_nvc, LaderTypeList[index].ToString());
                        index            += 1;
                    }
                    LaderTypeList_nvc = LaderTypeList_nvc.Substring(1, LaderTypeList_nvc.Length - 1);
                }

                string OrderColumns_nvc = string.Empty;
                if (Order1ComboBox.SelectedIndex != 0)
                {
                    OrderColumns_nvc = ((DataRowView)Order1ComboBox.SelectedItem)["ColumnName"].ToString();
                }
                if (Order2ComboBox.SelectedIndex != 0)
                {
                    OrderColumns_nvc += " , " + ((DataRowView)Order2ComboBox.SelectedItem)["ColumnName"].ToString();
                }
                if (Order3ComboBox.SelectedIndex != 0)
                {
                    OrderColumns_nvc += " , " + ((DataRowView)Order3ComboBox.SelectedItem)["ColumnName"].ToString();
                }
                if (Order4ComboBox.SelectedIndex != 0)
                {
                    OrderColumns_nvc += " , " + ((DataRowView)Order4ComboBox.SelectedItem)["ColumnName"].ToString();
                }
                if (Order5ComboBox.SelectedIndex != 0)
                {
                    OrderColumns_nvc += " , " + ((DataRowView)Order5ComboBox.SelectedItem)["ColumnName"].ToString();
                }

                if (OrderColumns_nvc.EndsWith(" , "))
                {
                    OrderColumns_nvc = OrderColumns_nvc.Remove(OrderColumns_nvc.Length - 2, 2);
                }
                ///Call Report
                //HPS.Reports.ReportDoc.LadBillCreditReport rpt = new HPS.Reports.ReportDoc.LadBillCreditReport(this.FromDatefaDatePicker.Text, this.ToDatefaDatePicker.Text, CompanyList_nvc, LaderTypeList_nvc, OrderColumns_nvc, this.NumberPlate_nvcTextBox.Text, this.SerialPlate_nvcTextBox.Text, this.CarCardNumber_nvcTextBox.Text, this.DriverCardNumber_nvcTextBox.Text);
                //viewer1.Document = rpt.Document;
                //rpt.Document.Printer.PrinterName = string.Empty;
                //rpt.Run();

                string condition = string.Empty;
                condition = "LadBillCredit_T.Date_nvc>='" + FromDatefaDatePicker.Text + "' AND LadBillCredit_T.Date_nvc<='" + ToDatefaDatePicker.Text + "' AND Canceled_bit=0 ";
                if (!string.IsNullOrEmpty(CompanyList_nvc))
                {
                    condition += " AND LadeAssignment_T.CompanyID_int IN ( " + CompanyList_nvc + " ) ";
                }
                if (!string.IsNullOrEmpty(LaderTypeList_nvc))
                {
                    condition += " AND Traffic_T.LaderTypeID_int IN ( " + LaderTypeList_nvc + " ) ";
                }
                if (!string.IsNullOrEmpty(NumberPlate_nvcTextBox.Text) && (!string.IsNullOrEmpty(SerialPlate_nvcTextBox.Text)))
                {
                    condition += " AND Traffic_T.NumberPlate_nvc = '" + NumberPlate_nvcTextBox.Text + "'  AND Traffic_T.SerialPlate_nvc =" + SerialPlate_nvcTextBox.Text;
                }
                if (!string.IsNullOrEmpty(CarCardNumber_nvcTextBox.Text))
                {
                    condition += " AND Traffic_T.CarCardNumber_nvc = " + CarCardNumber_nvcTextBox.Text;
                }
                if (!string.IsNullOrEmpty(DriverCardNumber_nvcTextBox.Text))
                {
                    condition += " AND Traffic_T.DriverCardNumber_nvc = " + DriverCardNumber_nvcTextBox.Text;
                }
                if (!string.IsNullOrEmpty(Days_intTextBox.Text))
                {
                    // تعداد روز هایی که راندگان در صف مانده اند
                    // روز های انتظار
                    condition += " AND datediff(day,dbo.ShamsiToMiladi(Traffic_T.Date_nvc),dbo.ShamsiToMiladi(LadBillCredit_T.Date_nvc)) <= " + Days_intTextBox.Text;
                }
                if (!string.IsNullOrEmpty(OrderColumns_nvc))
                {
                    condition += " ORDER BY " + OrderColumns_nvc;
                }
                else
                {
                    condition += " ORDER BY LadBillCreditID_int ";
                }

                LadBillCreditReportstiReport.Dictionary.Synchronize();
                LadBillCreditReportstiReport.Dictionary.Databases.Clear();
                LadBillCreditReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString));
                LadBillCreditReportstiReport.Compile();
                LadBillCreditReportstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys()
                {
                    SettingID_int = 1029
                }).Value_nvc.ToString();
                HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory();
                LadBillCreditReportstiReport["FromDate_vc"]   = FromDatefaDatePicker.Text;
                LadBillCreditReportstiReport["ToDate_vc"]     = ToDatefaDatePicker.Text;
                LadBillCreditReportstiReport["FromTime_vc"]   = FromDatefaDatePicker.Text;
                LadBillCreditReportstiReport["ToTime_vc"]     = ToDatefaDatePicker.Text;
                LadBillCreditReportstiReport["Date_vc"]       = PortPlaceFactory.ServerJalaliDate + "   " + PortPlaceFactory.ServerTime;;
                LadBillCreditReportstiReport["UserName_vc"]   = HPS.Common.CurrentUser.user.UserName_nvc;
                LadBillCreditReportstiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text;
                LadBillCreditReportstiReport["@todate_nvc"]   = ToDatefaDatePicker.Text;
                LadBillCreditReportstiReport["@fromtime_nvc"] = FromDatefaDatePicker.Text;
                LadBillCreditReportstiReport["@totime_nvc"]   = ToDatefaDatePicker.Text;
                LadBillCreditReportstiReport["@Condition"]    = condition;
                LadBillCreditReportstiReport.Render();
                stiViewerControl1.Report = LadBillCreditReportstiReport;
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #19
0
        private void PrintButton_Click(object sender, EventArgs e)
        {
            try
            {
                bool isCanceldedLadBill = (bool)LadBillWithTrafficGridView.CurrentRow.Cells["colCanceled_bit"].Value;
                //if (WithProductionYear == true && !FromDatefaDatePicker.IsNull && !ToDatefaDatePicker.IsNull)
                //{
                if (isCanceldedLadBill && HPS.Common.CurrentUser.user.UserGroupID_int != 1)
                {
                    throw new ApplicationException("این مجوز باطل شده و امکان چاپ ندارد");
                }
                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                string condition = string.Empty;

                if (!string.IsNullOrEmpty(ToDatefaDatePicker.Text) && !string.IsNullOrEmpty(FromDatefaDatePicker.Text))
                {
                    condition = string.Format(" LadBillCredit_T.Date_nvc>='{0}' And LadBillCredit_T.Date_nvc<='{1}'", FromDatefaDatePicker.Text, ToDatefaDatePicker.Text);
                }

                if (!string.IsNullOrEmpty(LadBillCrediteID_binttextBox.Text))
                {
                    condition += string.Format(" OR LadBillCredit_T.LadBillCreditID_int='{0}'", LadBillCrediteID_binttextBox.Text);
                }

                if (!string.IsNullOrEmpty(AcceptedTurnNumber_binttextBox.Text))
                {
                    condition += string.Format(" OR Traffic_T.AcceptedTurnNumber_bint='{0}'", AcceptedTurnNumber_binttextBox.Text);
                }

                if (!string.IsNullOrEmpty(DriverCardNumber_nvctextBox.Text))
                {
                    condition += string.Format(" OR  Driver_T.DriverCardNumber_nvc='{0}'", DriverCardNumber_nvctextBox.Text);
                }

                if (!string.IsNullOrEmpty(NationalCode_inttextBox.Text))
                {
                    condition += string.Format(" OR Driver_T.NationalCode_int='{0}'", NationalCode_inttextBox.Text);
                }
                if (!string.IsNullOrEmpty(DriverLastName_nvctextBox.Text))
                {
                    condition += string.Format(" OR Driver_T.LastName_nvc='{0}'", DriverLastName_nvctextBox.Text);
                }
                if (!string.IsNullOrEmpty(CarSerialnumbertextBox.Text) && !string.IsNullOrEmpty(NumberPlate_nvctextBox.Text))
                {
                    condition += string.Format(" OR Car_T.NumberPlate_nvc='{0}' And Car_T.SerialPlate_nvc = '{1}'", NumberPlate_nvctextBox.Text, CarSerialnumbertextBox.Text);
                }

                LadBillCreditReportstiReport.Dictionary.Synchronize();
                LadBillCreditReportstiReport.Dictionary.Databases.Clear();
                LadBillCreditReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString));
                LadBillCreditReportstiReport.Compile();
                HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory();
                LadBillCreditReportstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys()
                {
                    SettingID_int = 1029
                }).Value_nvc.ToString();
                LadBillCreditReportstiReport["FromDate_vc"]   = FromDatefaDatePicker.Text;
                LadBillCreditReportstiReport["ToDate_vc"]     = ToDatefaDatePicker.Text;
                LadBillCreditReportstiReport["FromTime_vc"]   = FromDatefaDatePicker.Text;
                LadBillCreditReportstiReport["ToTime_vc"]     = ToDatefaDatePicker.Text;
                LadBillCreditReportstiReport["Date_vc"]       = PortPlaceFactory.ServerJalaliDate + "   " + PortPlaceFactory.ServerTime;;
                LadBillCreditReportstiReport["UserName_vc"]   = HPS.Common.CurrentUser.user.UserName_nvc;
                LadBillCreditReportstiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text;
                LadBillCreditReportstiReport["@todate_nvc"]   = ToDatefaDatePicker.Text;
                LadBillCreditReportstiReport["@fromtime_nvc"] = FromDatefaDatePicker.Text;
                LadBillCreditReportstiReport["@totime_nvc"]   = ToDatefaDatePicker.Text;
                LadBillCreditReportstiReport["@Condition"]    = condition;
                LadBillCreditReportstiReport.Render();
                LadBillWithTrafficGridView.Visible = false;
                stiViewerControl1.Visible          = true;
                stiViewerControl1.Report           = LadBillCreditReportstiReport;
                //}
                //else
                //{
                //    HPS.Reports.Forms.LadBillCreditReporForm frm = new LadBillCreditReporForm();
                //    frm.ShowDialog();
                //}
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #20
0
        public IranianInNotOutTrafficReport(string FromDate, string ToDate, int TrafficType, int?PivotGroupID, int?ServicesID)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            FromDatetxt.Text = FromDate;
            ToDatetxt.Text   = ToDate;

            HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
            DataTable TrafficDataTable = new DataTable();
            string    Condition        = string.Empty;

            if (ServicesID.HasValue)
            {
                if (PivotGroupID.HasValue)
                {
                    Condition = String.Format("(T1.TrafficTypeID_int='1') AND (T1.Date_nvc>='{0}') AND (T1.Date_nvc<='{1}') AND (LaderPivotGroup_T.LaderPivotGroupID_int={2}) AND (T1.ServiceID_int={3})", FromDate, ToDate, PivotGroupID, ServicesID);
                }
                else
                {
                    Condition = String.Format("(T1.TrafficTypeID_int='1') AND (T1.Date_nvc>='{0}') AND (T1.Date_nvc<='{1}') AND (T1.ServiceID_int={2})", FromDate, ToDate, ServicesID);
                }
            }
            else
            {
                if (PivotGroupID.HasValue)
                {
                    Condition = String.Format("(T1.TrafficTypeID_int='1') AND (T1.Date_nvc>='{0}') AND (T1.Date_nvc<='{1}') AND (LaderPivotGroup_T.LaderPivotGroupID_int={2})", FromDate, ToDate, PivotGroupID);
                }
                else
                {
                    Condition = String.Format("(T1.TrafficTypeID_int='1') AND (T1.Date_nvc>='{0}') AND (T1.Date_nvc<='{1}')", FromDate, ToDate);
                }
            }

            TrafficFactory.GetAllByConditionAllInTrafficNotTemporaryOut(Condition, ref TrafficDataTable);

            TrafficDataTable.Columns.Add(new DataColumn("AllPayment_dec", typeof(decimal)));
            TrafficDataTable.Columns.Add(new DataColumn("Remained_dec", typeof(decimal)));

            HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
            HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys    LaderTypeKey     = new HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys();
            string stopFeeCondition = string.Empty;
            var    stopFeeFactory   = new BLL.StopFeeBLL.BLLStopFee_TFactory();

            BLL.StopFeeBLL.BLLStopFee_T     oldStopFeeEntity = null;
            BLL.StopFeeBLL.BLLStopFee_TKeys stopFeeKey       = null;
            BLL.LaderTypeBLL.BLLLaderType_T laderTypeEntity  = null;
            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
            DataTable TrafficInWithladBillDataTable = null;
            DataTable TrafficInDatatable            = null;

            HPS.BLL.SettingsBLL.BLLSetting_TFactory settingsFactory       = new HPS.BLL.SettingsBLL.BLLSetting_TFactory();
            HPS.BLL.SettingsBLL.BLLSetting_TKeys    SettingKey            = null;
            HPS.BLL.SettingsBLL.BLLSetting_T        TurnHourSettingEntity = null;
            HPS.BLL.SettingsBLL.BLLSetting_T        SettingEntity         = null;

            foreach (DataRow row in TrafficDataTable.Rows)
            {
                DataTable LaderTypeDataTable = new DataTable();
                try
                {
                    oldStopFeeEntity         = new BLL.StopFeeBLL.BLLStopFee_T();
                    stopFeeKey               = new BLL.StopFeeBLL.BLLStopFee_TKeys();
                    stopFeeKey.StopFeeID_int = Convert.ToInt32(row["StopFeeID_int"]);
                    oldStopFeeEntity         = stopFeeFactory.GetBy(stopFeeKey);
                    if ((Int32)row["TrafficTypeID_int"] == 1)
                    {
                        laderTypeEntity = new BLL.LaderTypeBLL.BLLLaderType_T();
                        LaderTypeKey.LaderTypeID_int = Convert.ToInt32(row["LaderTypeID_int"]);
                        laderTypeEntity  = LaderTypeFactory.GetBy(LaderTypeKey);
                        stopFeeCondition = string.Format(" StartDate_nvc>'{0}' AND StopFee_T.TrafficTypeID_int={1} AND StopFee_T.ServicesID_int={2} AND StopFee_T.LaderPivotGroupID_int={3}", oldStopFeeEntity.EndDate_nvc, Convert.ToInt32(row["TrafficTypeID_int"]), Convert.ToInt32(row["ServiceID_int"]), laderTypeEntity.LaderPivotGroupID_int);
                    }
                    else
                    {
                        stopFeeCondition = string.Format(" StartDate_nvc>'{0}' AND StopFee_T.TrafficTypeID_int={1}", oldStopFeeEntity.StartDate_nvc, Convert.ToInt32(row["TrafficTypeID_int"]));
                    }
                    var newStopFeeTable = new DataTable();
                    stopFeeFactory.GetAllByCondition(stopFeeCondition, ref newStopFeeTable);

                    Hepsa.Core.Common.MyDateTime InDateTime  = new Hepsa.Core.Common.MyDateTime(row["Date_nvc"].ToString());
                    Hepsa.Core.Common.MyDateTime OutDateTime = new Hepsa.Core.Common.MyDateTime(TrafficFactory.ServerJalaliDate);

                    string InDate  = InDateTime.MyDate.ToString("yyyy/MM/dd");  //+ " " +  InTime_nvcTextBox.Text;
                    string OutDate = OutDateTime.MyDate.ToString("yyyy/MM/dd"); // + " " +  Time_nvcTextBox.Text;


                    if (InDate.Length == 16)
                    {
                        InDate += ":00";
                    }
                    else if (InDate.Length > 19)
                    {
                        InDate = InDate.Substring(0, 19);
                    }

                    if (OutDate.Length == 16)
                    {
                        OutDate += ":00";
                    }
                    else if (OutDate.Length > 19)
                    {
                        OutDate = OutDate.Substring(0, 19);
                    }



                    decimal Price = Convert.ToDecimal(row["Fee_dec"]);
                    if (Convert.ToInt32(row["ServiceID_int"]) == 2)
                    {
                        Price = row["Fee_dec"] != null?Convert.ToInt32(row["Fee_dec"]) : 0;
                    }
                    string incondition = "Traffic_T.TrafficNumber_bint='" + row["TrafficNumber_bint"].ToString() + "'";
                    Condition = string.Format("Traffic_T.TurnNumber_bint='{0}' And Traffic_T.TrafficNumber_bint<>{1}", row["TurnNumber_bint"], row["TrafficNumber_bint"].ToString());
                    TrafficInWithladBillDataTable = new DataTable();
                    LadBillFactory.GetAllWithTrafficLadBillCreditByConditon(incondition, ref TrafficInWithladBillDataTable);

                    TrafficInDatatable = new DataTable();
                    TrafficFactory.GetAllByCondition(Condition, ref TrafficInDatatable);

                    SettingKey = new HPS.BLL.SettingsBLL.BLLSetting_TKeys();
                    SettingKey.SettingID_int = 1002;
                    TurnHourSettingEntity    = settingsFactory.GetBy(SettingKey);

                    if (TrafficInDatatable.Rows.Count > 0)
                    {
                        DateTime TrafficDate   = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(TrafficInDatatable.Rows[0]["Date_nvc"].ToString())).MyDate.ToString("yyyy/MM/dd") + " " + TrafficInDatatable.Rows[0]["Time_nvc"].ToString());
                        Int32    Allowablehour = Convert.ToInt32(TurnHourSettingEntity.Value_nvc);
                        if (TrafficFactory.ServerDate <= TrafficDate.AddHours(Allowablehour))
                        {
                            if (TrafficInWithladBillDataTable.Rows.Count == 0)
                            {
                                Price = 0;
                            }
                        }
                    }

                    decimal  Balanced = 0;
                    TimeSpan ts       = new TimeSpan();
                    if (newStopFeeTable != null && newStopFeeTable.Rows.Count > 0)
                    {
                        //Hepsa.Core.Common.MyDateTime stopFeeMiladiEndDate_nvc = new Hepsa.Core.Common.MyDateTime(newStopFeeTable.Rows[0]["EndDate_nvc"].ToString());
                        //string stopFeeEndDate_nvc = stopFeeMiladiEndDate_nvc.MyDate.ToString("yyyy/MM/dd");
                        Hepsa.Core.Common.MyDateTime stopFeeMiladiEndDate_nvc = new Hepsa.Core.Common.MyDateTime(oldStopFeeEntity.EndDate_nvc);
                        string stopFeeEndDate_nvc = stopFeeMiladiEndDate_nvc.MyDate.ToString("yyyy/MM/dd");
                        ts = DateTime.Parse(stopFeeEndDate_nvc).Subtract(DateTime.Parse(InDate));

                        if (Convert.ToBoolean(row["TurnAccepted_bit"]) == true)
                        {
                            double ExtraHour = ts.TotalHours;
                            SettingEntity            = new HPS.BLL.SettingsBLL.BLLSetting_T();
                            SettingKey.SettingID_int = 1002;
                            SettingEntity            = settingsFactory.GetBy(SettingKey);
                            ExtraHour -= Convert.ToDouble(SettingEntity.Value_nvc);
                            if (ExtraHour > 0)
                            {
                                ///محاسبه مازاد بر اساس قیمت قبلی از ورود تا شروع قیمت جدید
                                int days = (int)(ExtraHour / Convert.ToInt32(row["ExtraHour_int"]));
                                Price += Math.Floor(((decimal)(days)) * Convert.ToDecimal(row["ExtraHourFee_dec"]));
                            }

                            Hepsa.Core.Common.MyDateTime stopFeeMiladiStartDate_nvc = new Hepsa.Core.Common.MyDateTime(newStopFeeTable.Rows[0]["StartDate_nvc"].ToString());
                            string   newStopFeeStartDate_nvc = stopFeeMiladiStartDate_nvc.MyDate.ToString("yyyy/MM/dd");
                            TimeSpan ExtaTS         = DateTime.Parse(newStopFeeStartDate_nvc).Subtract(DateTime.Parse(InDate));
                            double   ExtraExtraHour = ExtaTS.TotalHours;
                            if (ExtraExtraHour < Convert.ToDouble(SettingEntity.Value_nvc))
                            {
                                ///محاسبه مازاد از شروع تاریخ قیمت جدید تا تاریخ خروج
                                if (ExtraHour >= 0)
                                {
                                    ts = DateTime.Parse(OutDate).AddDays(1).Subtract(DateTime.Parse(InDate));
                                }
                                else
                                {
                                    ts = DateTime.Parse(OutDate).Subtract(DateTime.Parse(InDate));
                                }


                                ExtraHour = ts.TotalHours - Convert.ToDouble(SettingEntity.Value_nvc);
                                if (ExtraHour >= 0)
                                {
                                    Int32 days = Convert.ToInt32((ExtraHour / Convert.ToInt32(newStopFeeTable.Rows[0]["ExtraHour_int"])));
                                    Price += Math.Floor((Convert.ToDecimal((days)) * Convert.ToDecimal(newStopFeeTable.Rows[0]["ExtraHourFee_dec"])));
                                }
                            }
                            else
                            {
                                ///محاسبه مازاد از شروع تاریخ قیمت جدید تا تاریخ خروج
                                //Hepsa.Core.Common.MyDateTime stopFeeMiladiStartDate_nvc = new Hepsa.Core.Common.MyDateTime(newStopFeeTable.Rows[0]["StartDate_nvc"].ToString());
                                //string newStopFeeStartDate_nvc = stopFeeMiladiStartDate_nvc.MyDate.ToString("yyyy/MM/dd");
                                //ts = DateTime.Parse(OutDate).AddDays(1).Subtract(DateTime.Parse(newStopFeeStartDate_nvc));
                                if (ExtraHour > 0)
                                {
                                    ts = DateTime.Parse(OutDate).AddDays(1).Subtract(DateTime.Parse(newStopFeeStartDate_nvc));
                                }
                                else
                                {
                                    ts = DateTime.Parse(OutDate).Subtract(DateTime.Parse(newStopFeeStartDate_nvc));
                                }

                                ExtraHour = ts.TotalHours;
                                if (ExtraHour > 0)
                                {
                                    Int32 days = Convert.ToInt32((ExtraHour / Convert.ToInt32(newStopFeeTable.Rows[0]["ExtraHour_int"])));
                                    Price += Math.Floor((Convert.ToDecimal((days)) * Convert.ToDecimal(newStopFeeTable.Rows[0]["ExtraHourFee_dec"])));
                                }
                            }
                        }
                        else
                        {
                            if (Convert.ToDecimal(row["ExtraHourFee_dec"]) != 0)
                            {
                                ///محاسبه مازاد بر اساس قیمت قبلی از ورود تا شروع قیمت جدید
                                double ExtraHour = ts.TotalHours - Convert.ToDouble(row["AllowableHour_int"]);
                                int    days      = Convert.ToInt32((ExtraHour / Convert.ToInt32(row["ExtraHour_int"])));
                                Price += Math.Floor(((decimal)(days)) * Convert.ToDecimal(row["ExtraHourFee_dec"]));

                                ///محاسبه مازاد از شروع تاریخ قیمت جدید تا تاریخ خروج
                                Hepsa.Core.Common.MyDateTime stopFeeMiladiStartDate_nvc = new Hepsa.Core.Common.MyDateTime(newStopFeeTable.Rows[0]["StartDate_nvc"].ToString());
                                string newStopFeeStartDate_nvc = stopFeeMiladiStartDate_nvc.MyDate.ToString("yyyy/MM/dd");
                                ts        = DateTime.Parse(OutDate).AddDays(1).Subtract(DateTime.Parse(newStopFeeStartDate_nvc));
                                ExtraHour = ts.TotalHours;
                                days      = (int)(ExtraHour / (int)newStopFeeTable.Rows[0]["ExtraHour_int"]);
                                Price    += Math.Floor(((decimal)(days)) * Convert.ToDecimal(newStopFeeTable.Rows[0]["ExtraHourFee_dec"]));
                            }
                        }
                    }
                    else
                    {
                        ts = DateTime.Parse(OutDate).Subtract(DateTime.Parse(InDate));

                        if (ts.TotalHours > Convert.ToInt32(row["AllowableHour_int"]))
                        {
                            if (Convert.ToBoolean(row["TurnAccepted_bit"]) == true)
                            {
                                double ExtraHour = ts.TotalHours;
                                SettingEntity            = new BLL.SettingsBLL.BLLSetting_T();
                                SettingKey.SettingID_int = 1002;
                                SettingEntity            = settingsFactory.GetBy(SettingKey);
                                ExtraHour -= Convert.ToDouble(SettingEntity.Value_nvc);
                                if (ExtraHour > 0)
                                {
                                    int days = (int)(ExtraHour / Convert.ToInt32(row["ExtraHour_int"]));
                                    Price += Math.Floor(((decimal)(days)) * Convert.ToDecimal(row["ExtraHourFee_dec"]));
                                }
                                //else
                                //{
                                //    Price = 0;
                                //}
                            }
                            else
                            {
                                if (Convert.ToDecimal(row["ExtraHourFee_dec"]) != 0)
                                {
                                    double ExtraHour = ts.TotalHours - Convert.ToDouble(row["AllowableHour_int"]);
                                    int    days      = (int)(ExtraHour / Convert.ToInt32(row["ExtraHour_int"]));
                                    Price += Math.Floor(((decimal)(days)) * Convert.ToDecimal(row["ExtraHourFee_dec"]));
                                }
                            }
                        }
                    }

                    row["AllPayment_dec"] = Convert.ToString(Price);//+ Balanced
                    if (Price == Balanced)
                    {
                        row["Remained_dec"] = "0";
                    }
                    else
                    {
                        row["Remained_dec"] = Price - Convert.ToDecimal(row["Price_dec"]);//
                    }
                    if ((Price - Balanced) < 0)
                    {
                        row["Remained_dec"] = Convert.ToDecimal(row["Price_dec"]);
                    }
                }
                catch (Exception ex)
                {
                    Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
                }
            } //AllPayment_dec

            DataSource                    = TrafficDataTable;
            Datetxt.DataField             = "Date_nvc";
            Timetxt.DataField             = "Time_nvc";
            TurnNumbertxt.DataField       = "TurnNumber_bint";
            TrafficNumbertxt.DataField    = "TrafficNumber_bint";
            NumberPlateTextBox.DataField  = "NumberPlate_nvc";
            PlateCitytxt.DataField        = "PlateCityID_intPlateCity_nvc";
            SerialPlateTextBox.DataField  = "SerialPlate_nvc";
            CarCardNumbertxt.DataField    = "CarCardNumber_nvc";
            DriverCardNumbertxt.DataField = "DriverCardNumber_nvc";
            Pricetxt.DataField            = "Price_dec";
            Usertxt.DataField             = "UserName_nvc";
            LastNametxt.DataField         = "FullName_nvc";
            TurnAcceptedchk.DataField     = "TurnAccepted_bit";
            ServiceType_nvctxt.DataField  = "ServiceID_intServiceType_nvc";
            DriverCardNumbertxt.DataField = "DriverInfraction_nvc";
            CarInfractiontxt.DataField    = "CarInfraction_nvc";
            payment_dectxt.DataField      = "AllPayment_dec";
            remained_dectxt.DataField     = "Remained_dec";
            DateTextBox.Text              = TrafficFactory.ServerJalaliDate;
            TimeTextBox.Text              = TrafficFactory.ServerTime;
            UserNameTextBox.Text          = HPS.Common.CurrentUser.user.UserName_nvc;

            decimal?AllPrice = (from row in TrafficDataTable.AsEnumerable() select(decimal?) row["Price_dec"]).Sum();

            AllPricetxt.Text = AllPrice.HasValue ? AllPrice.ToString() : "0";

            decimal?AllPayment_dec = (from row in TrafficDataTable.AsEnumerable() select(decimal?) row["AllPayment_dec"]).Sum();

            allPayment_dectxt.Text = AllPayment_dec.HasValue ? AllPayment_dec.ToString() : "0";

            decimal?AllRemained_dec = (from row in TrafficDataTable.AsEnumerable() select(decimal?) row["Remained_dec"]).Sum();

            allRemained_dectxt.Text = AllRemained_dec.HasValue ? AllRemained_dec.ToString() : "0";
        }
コード例 #21
0
        private void LadeCancelStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
                HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory LadeCancelAssignmentFactory = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory();

                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LadeAssignmentKey = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys();
                LadeAssignmentKey.LadeAssignmentID_bint = (Int64?)this.LadeAssignmentGridView.CurrentRow.Cells["colLadeAssignmentID_bint"].Value;
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T LadeAssignmentEntity = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T();
                LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKey);
                if (LadeAssignmentEntity.Accepted_bit == true)
                {
                    HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_TFactory LadeAssignmentCacelRequestFactory = new HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_TFactory();
                    DataTable LadeAssignmentCacelRequestDataTable = new DataTable();
                    LadeAssignmentCacelRequestFactory.GetAllBy(HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_T.LadeAssignmentCacelRequest_TField.LadeAssignmentID_bint, LadeAssignmentKey.LadeAssignmentID_bint, ref LadeAssignmentCacelRequestDataTable);
                    if (!(LadeAssignmentCacelRequestDataTable != null && LadeAssignmentCacelRequestDataTable.Rows.Count > 0 && HPS.Common.CurrentUser.user.CompanyID_int.HasValue == false))
                    {
                        throw new ApplicationException("این اطلاع سرانی بار تأیید شده است و قابل تغییر نمی باشد");
                    }
                    if (string.IsNullOrEmpty(LadeAssignmentCacelRequestDataTable.Rows[0]["AcceptedDate_nvc"].ToString()))
                    {
                        throw new ApplicationException("درخواست انصراف یا اعمال تغییرات قبول نشده است");
                    }
                }

                DataTable remainedLadeAssignmentTable = new DataTable();
                string    remainedCarCondition        = string.Format("LadeAssignmentID_bint={0}", Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64));
                LadeAssignmentFactory.SelectRemainedDetailSelectByCondition(remainedCarCondition, remainedLadeAssignmentTable);
                int remaindCount_int = 0;
                if (remainedLadeAssignmentTable != null && remainedLadeAssignmentTable.Rows.Count > 0)
                {
                    remaindCount_int = (Int32)remainedLadeAssignmentTable.Rows[remainedLadeAssignmentTable.Rows.Count - 1]["RemainderCount_int"];
                }

                if (remaindCount_int == 0)
                {
                    string LadeCancelCondition = string.Format("LadeCancelAssignment_T.LadeAssignmentID_bint={0}", Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64));
                    List <HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T> LadeCancelList = LadeCancelAssignmentFactory.GetAllByCondition(LadeCancelCondition);
                    if (LadeCancelList != null && LadeCancelList.Count > 0)
                    {
                        throw new ApplicationException("بار مورد نظر باطل شده است");
                    }
                    else
                    {
                        HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                        string condition = "LadBillCredit_T.LadeAssignmentID_bint='" + Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64) + "' and LadBillCredit_T.LadBillCreditID_int is not null and LadBillCredit_T.Canceled_bit=0 ";
                        List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T> LadBillCreditList = new List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T>();
                        LadBillCreditList = LadBillCreditFactory.GetAllByCondition(condition);

                        if (LadBillCreditList != null && LadBillCreditList.Count > 0)
                        {
                            throw new ApplicationException("بار مورد نظر مجوز گرفته است");
                        }
                    }
                }
                HPS.Present.LadeCancelAssignment.LadeCancelAssignmentEntityForm LadeCancelAssignment = new HPS.Present.LadeCancelAssignment.LadeCancelAssignmentEntityForm(LadeAssignmentKey);
                LadeCancelAssignment.ShowDialog();
                LadeAssignmentGridView_SelectionChanged(this.LadeAssignmentCommentGridView, null);
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #22
0
        public LadBillReport(Int32 LadBillCreditID, int again)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys    LadBillKey           = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys();
            LadBillKey.LadBillCreditID_int = LadBillCreditID;
            DataTable LadBillLadeAssignmentDataTable = new DataTable();

            LadBillCreditFactory.GetAllLadeAssignment(LadBillKey, ref LadBillLadeAssignmentDataTable);
            if (!string.IsNullOrEmpty(LadBillLadeAssignmentDataTable.Rows[0]["DriverCardNumber_nvc"].ToString()))
            {
                DriverCardNumebrtxt.Text = " کارت هوشمند راننده: " + LadBillLadeAssignmentDataTable.Rows[0]["DriverCardNumber_nvc"].ToString();
            }
            else
            {
                DriverCardNumebrtxt.Text = " کارت هوشمند راننده:فاقد كارت ";
            }
            if (!string.IsNullOrEmpty(LadBillLadeAssignmentDataTable.Rows[0]["CarCardNumber_nvc"].ToString()))
            {
                CarCardNumbertxt.Text = " کارت هوشمند کامیون : " + LadBillLadeAssignmentDataTable.Rows[0]["CarCardNumber_nvc"].ToString();
            }
            else
            {
                CarCardNumbertxt.Text = " کارت هوشمند کامیون :فاقد كارت ";
            }

            DriverMobileNumber_nvctxt.Text = string.Format("موبایل راننده: {0}", LadBillLadeAssignmentDataTable.Rows[0]["DriverMobileNumber_nvc"].ToString());
            Companytxt.Text       = LadBillLadeAssignmentDataTable.Rows[0]["CompanyID_intCompany_nvc"].ToString() + "(" + LadBillLadeAssignmentDataTable.Rows[0]["CompanyCode_nvc"].ToString() + ")" + "(" + LadBillLadeAssignmentDataTable.Rows[0]["Phone_nvc"].ToString() + ")";                                         //Cmp_nvc
            LaderTypetxt.Text     = LadBillLadeAssignmentDataTable.Rows[0]["LaderTypeID_intLaderType_nvc"].ToString();
            Boxingtxt.Text        = LadBillLadeAssignmentDataTable.Rows[0]["BoxingID_intBoxingType_nvc"].ToString();                                                                                                                                                                                                       //LaderType
            NumberPlatetxt.Text   = Hepsa.Core.Common.PersentationController.CorrectNumberPlate(LadBillLadeAssignmentDataTable.Rows[0]["NumberPlate_nvc"].ToString()) + " - " + LadBillLadeAssignmentDataTable.Rows[0]["PlateCity_nvc"].ToString() + LadBillLadeAssignmentDataTable.Rows[0]["SerialPlate_nvc"].ToString(); //Plaque
            DriverNametxt.Text    = LadBillLadeAssignmentDataTable.Rows[0]["DriverName"].ToString();                                                                                                                                                                                                                       //Driver
            LicenceNumbertxt.Text = LadBillLadeAssignmentDataTable.Rows[0]["licenceNumber_int"].ToString();                                                                                                                                                                                                                //LicenceNumber
            LicenceCitytxt.Text   = LadBillLadeAssignmentDataTable.Rows[0]["LicenceCityID_intCity_nvc"].ToString();                                                                                                                                                                                                        //LicenceCity
            Goodtxt.Text          = LadBillLadeAssignmentDataTable.Rows[0]["GoodID_intGood_nvc"].ToString();                                                                                                                                                                                                               //Good
            LadingDatetxt.Text    = LadBillLadeAssignmentDataTable.Rows[0]["LadingDate_nvc"].ToString();                                                                                                                                                                                                                   //
            Destinationtxt.Text   = LadBillLadeAssignmentDataTable.Rows[0]["CityID_intCity_nvc"].ToString() + "-" + LadBillLadeAssignmentDataTable.Rows[0]["Address_nvc"].ToString();
            HamrahanSystem.TextBox.NumericTextBox txt = new HamrahanSystem.TextBox.NumericTextBox();
            txt.DigitsInGroup         = 3;
            txt.Text                  = LadBillLadeAssignmentDataTable.Rows[0]["PortageFee_dec"].ToString();
            PortageFeetxt.Text        = txt.Text;
            Commenttxt.Text           = LadBillLadeAssignmentDataTable.Rows[0]["AssignmentComment_nvc"].ToString();
            Datetxt.Text              = LadBillLadeAssignmentDataTable.Rows[0]["LadBillDate"].ToString();
            Timetxt.Text              = LadBillLadeAssignmentDataTable.Rows[0]["LadBillTime"].ToString();
            TurnNumbertxt.Text        = LadBillLadeAssignmentDataTable.Rows[0]["AcceptedTurnNumber_bint"].ToString();
            LadBillNumbertxt.Text     = LadBillLadeAssignmentDataTable.Rows[0]["LadBillCreditID_int"].ToString();
            UserNametxt.Text          = LadBillLadeAssignmentDataTable.Rows[0]["LadBillUser"].ToString();
            PortPlacetxt.Text         = LadBillLadeAssignmentDataTable.Rows[0]["PortPlaceID_intPortPlaces_nvc"].ToString();
            MinWeightTextBox.Text     = "از وزن: " + LadBillLadeAssignmentDataTable.Rows[0]["MinWeight_dec"].ToString();
            MaxWeightTextBox.Text     = "تا وزن: " + LadBillLadeAssignmentDataTable.Rows[0]["MaxWeight_dec"].ToString();
            TrafficNumberTextBox.Text = LadBillLadeAssignmentDataTable.Rows[0]["TrafficNumber_bint"].ToString();

            HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillMessage_TFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();
            List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillMessage_TList    = new List <HPS.BLL.BillMessageBLL.BLLBillMessage_T>();
            string Condition = string.Format("TrafficType_T.TrafficTypeID_int=9 AND [BillMessage_T].StartDate_nvc<='{0}' AND [BillMessage_T].[EndDate_nvc]>='{0}' ", BillMessage_TFactory.ServerJalaliDate);

            BillMessage_TList = BillMessage_TFactory.GetAllByCondition(Condition);
            if (BillMessage_TList != null && BillMessage_TList.Count > 0)
            {
                BillMessageTextBox.Text = BillMessage_TList[0].Message_nvc;
            }
            if (again != 1)
            {
                if (LadBillLadeAssignmentDataTable.Rows[0]["LadeDate"].ToString().CompareTo(LadBillCreditFactory.ServerJalaliDate) < 0)
                {
                    RemaintextBox.Visible = true;
                }
                else
                {
                    RemaintextBox.Visible = false;
                }
            }

            AgainDatetxt.Text = LadBillCreditFactory.ServerJalaliDate;
            AgainTimetxt.Text = LadBillCreditFactory.ServerTime;
            if (again == 1)
            {
                Againtxt.Visible     = true;
                txtDate.Visible      = true;
                AgainDatetxt.Visible = true;
                txtTime.Visible      = true;
                AgainTimetxt.Visible = true;
                txtuser.Visible      = true;
                AgainUsertxt.Visible = true;
                AgainUsertxt.Text    = HPS.Common.CurrentUser.user.UserName_nvc;
            }
        }
コード例 #23
0
        private void StimulViewer_Load(object sender, EventArgs e)
        {
            //try
            //{
            if (_Traffic_bit == false && _Othercar_bit == false)
            {
                AcceptedTurnstiReport.Dictionary.Synchronize();
                AcceptedTurnstiReport.Dictionary.Databases.Clear();
                AcceptedTurnstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString));
                AcceptedTurnstiReport.Compile();
                AcceptedTurnstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys()
                {
                    SettingID_int = 1029
                }).Value_nvc.ToString();
                HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory   PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory();
                HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillFactory      = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();
                if (TrafficEntity.BillMessageID_int == 0 || TrafficEntity.BillMessageID_int == null)
                {
                }
                else
                {
                    string Billcondition = "[BillMessage_T].[BillMessageID_int]=" + TrafficEntity.BillMessageID_int;
                    List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillLst = BillFactory.GetAllByCondition(Billcondition);
                    if (BillLst != null)
                    {
                        AcceptedTurnstiReport["Messagetxt"]  = BillLst[0].Message_nvc;
                        AcceptedTurnstiReport["Message_bit"] = true;
                    }
                    else
                    {
                        AcceptedTurnstiReport["Message_bit"] = false;
                    }
                }
                NumericTextBox txt = new NumericTextBox();
                txt.DigitsInGroup = 3;
                if (TrafficEntity.Price_dec != null)
                {
                    txt.Text = TrafficEntity.Price_dec.ToString();
                    AcceptedTurnstiReport["Price_nvc"] = " مبلغ دریافت شده هنگام ورود " + txt.Text + "  ريال می باشد";
                }
                if (TrafficEntity.Price_dec != null)
                {
                    AcceptedTurnstiReport["PricewithOutTax_nvc"] = (TrafficEntity.Price_dec - TrafficEntity.PriceTax_dec).ToString();
                }

                if (!string.IsNullOrEmpty(TrafficEntity.AcceptedTurnComment_nvc))
                {
                    if (TrafficEntity.Area_bit)
                    {
                        AcceptedTurnstiReport["Comment_nvc"] = "توضيحات : " + TrafficEntity.AcceptedTurnComment_nvc;// +" حومه";
                    }
                    else
                    {
                        AcceptedTurnstiReport["Comment_nvc"] = "توضيحات : " + TrafficEntity.AcceptedTurnComment_nvc;
                    }
                }
                else
                {
                    //if (TrafficEntity.Area_bit)
                    //{
                    //    AcceptedTurnstiReport["Comment_nvc"] = "حومه";
                    //}
                }
                if (TrafficEntity.TurnPrinted_bit == true)
                {
                    AcceptedTurnstiReport["PrintedAgain_nvc"] = "المثنی";
                }
                else
                {
                    AcceptedTurnstiReport["PrintedAgain_nvc"] = "";
                }

                HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlatecityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory();
                HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys    Platecitykey     = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys();
                Platecitykey.PlateCityID_int = TrafficEntity.PlateCityID_int;
                HPS.BLL.PlateCityBLL.BLLPlateCity_T PlateCityEntity = new HPS.BLL.PlateCityBLL.BLLPlateCity_T();
                PlateCityEntity = PlatecityFactory.GetBy(Platecitykey);

                if (PlateCityEntity != null)
                {
                    AcceptedTurnstiReport["Number_nvc"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + PlateCityEntity.PlateCity_nvc + " " + TrafficEntity.SerialPlate_nvc;
                }
                else
                {
                    AcceptedTurnstiReport["Number_nvc"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + TrafficEntity.SerialPlate_nvc;
                }

                if (TrafficEntity.LadeReturn_bit == true)
                {
                    AcceptedTurnstiReport["TurnNumber"] = "برگشت از بار";
                }
                else
                {
                    if (TrafficEntity.AcceptedTurnNumber_bint.HasValue)
                    {
                        AcceptedTurnstiReport["TurnNumber"] = "شماره نوبت : " + TrafficEntity.AcceptedTurnNumber_bint.ToString();
                    }
                    else
                    {
                        AcceptedTurnstiReport["TurnNumber"] = "شماره نوبت رزرو : " + TrafficEntity.TurnNumber_bint.ToString();
                    }
                }

                AcceptedTurnstiReport["TrafficNumber"] = " شماره قبض پارکینگ: " + TrafficEntity.TrafficNumber_bint.ToString();


                AcceptedTurnstiReport["InDate_vc"]    = TrafficEntity.Date_nvc;
                AcceptedTurnstiReport["InTime_vc"]    = TrafficEntity.Time_nvc;
                AcceptedTurnstiReport["Time_vc"]      = PortPlaceFactory.ServerTime;
                AcceptedTurnstiReport["Date_vc"]      = PortPlaceFactory.ServerJalaliDate;
                AcceptedTurnstiReport["username_nvc"] = HPS.Common.CurrentUser.user.UserName_nvc;


                HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory laderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
                string LaderTypecondition = "[LaderType_T].[LaderTypeID_int]='" + TrafficEntity.LaderTypeID_int + "'";

                AcceptedTurnstiReport["@TrafficID_bint"] = TrafficEntity.TrafficID_bint;
                AcceptedTurnstiReport["@Condition"]      = LaderTypecondition;
                AcceptedTurnstiReport.Render();

                Properties.Settings s = new HPS.Properties.Settings();
                System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings();
                if (string.IsNullOrEmpty(s.PrinterName))
                {
                    AcceptedTurnstiReport.Print(true);
                }
                else
                {
                    PrinterSetting.PrinterName = s.PrinterName;
                    AcceptedTurnstiReport.Print(false, PrinterSetting);
                }

                this.Close();
            }

            else if (_Traffic_bit == true && _Othercar_bit == false)
            {
                TrafficstiReport.Dictionary.Synchronize();
                TrafficstiReport.Dictionary.Databases.Clear();
                TrafficstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString));
                TrafficstiReport.Compile();
                TrafficstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys()
                {
                    SettingID_int = 1029
                }).Value_nvc.ToString();
                HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory   PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory();
                HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillFactory      = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();
                if (TrafficEntity.BillMessageID_int == 0 || TrafficEntity.BillMessageID_int == null)
                {
                }
                else
                {
                    string Billcondition = "[BillMessage_T].[BillMessageID_int]=" + TrafficEntity.BillMessageID_int;
                    List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillLst = BillFactory.GetAllByCondition(Billcondition);
                    if (BillLst != null)
                    {
                        TrafficstiReport["Messagetxt"]  = BillLst[0].Message_nvc;
                        TrafficstiReport["Message_bit"] = true;
                    }
                    else
                    {
                        TrafficstiReport["Message_bit"] = false;
                    }
                }
                NumericTextBox txt = new NumericTextBox();
                txt.DigitsInGroup = 3;
                if (TrafficEntity.Price_dec != null)
                {
                    txt.Text = TrafficEntity.Price_dec.ToString();
                    TrafficstiReport["Price_nvc"] = " مبلغ دریافت شده هنگام ورود " + txt.Text + "  ريال می باشد";
                }

                if (!string.IsNullOrEmpty(TrafficEntity.AcceptedTurnComment_nvc))
                {
                    if (TrafficEntity.Area_bit)
                    {
                        TrafficstiReport["Comment_nvc"] = "توضيحات : " + TrafficEntity.AcceptedTurnComment_nvc;// +" حومه";
                    }
                    else
                    {
                        TrafficstiReport["Comment_nvc"] = "توضيحات : " + TrafficEntity.AcceptedTurnComment_nvc;
                    }
                }
                else
                {
                    //if (TrafficEntity.Area_bit)
                    //{
                    //    TrafficstiReport["Comment_nvc"] = "حومه";
                    //}
                }
                if (TrafficEntity.TurnPrinted_bit == true)
                {
                    TrafficstiReport["PrintedAgain_nvc"] = "المثنی";
                }
                else
                {
                    TrafficstiReport["PrintedAgain_nvc"] = "";
                }

                HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlatecityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory();
                HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys    Platecitykey     = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys();
                Platecitykey.PlateCityID_int = TrafficEntity.PlateCityID_int;
                HPS.BLL.PlateCityBLL.BLLPlateCity_T PlateCityEntity = new HPS.BLL.PlateCityBLL.BLLPlateCity_T();
                PlateCityEntity = PlatecityFactory.GetBy(Platecitykey);

                if (PlateCityEntity != null)
                {
                    TrafficstiReport["Number_nvc"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + PlateCityEntity.PlateCity_nvc + " " + TrafficEntity.SerialPlate_nvc;
                }
                else
                {
                    TrafficstiReport["Number_nvc"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + TrafficEntity.SerialPlate_nvc;
                }


                if (TrafficEntity.ServiceID_int == 2)
                {
                    if (TrafficEntity.TurnAccepted_bit == true)
                    {
                        //نوبت تأیید شده داره
                        TrafficstiReport["TurnNumber"] = "شماره نوبت :   " + Convert.ToString(TrafficEntity.AcceptedTurnNumber_bint);
                        //AcceptedDate2TextBox.Text = TrafficEntityrpt.TurnDate_nvc;
                        //AcceptedTime2TextBox.Text = TrafficEntityrpt.TurnTime_nvc;
                        //TurnNumber2txt.Text = TrafficEntityrpt.AcceptedTurnNumber_bint.ToString();
                    }
                    else
                    {
                        //نوبت تأیید شده ندارد
                        TrafficstiReport["TurnNumber"] = "شماره نوبت رزرو :   " + Convert.ToString(TrafficEntity.TurnNumber_bint);
                    }
                }
                else
                {
                    // (عدم نمایش نوبت (مراجعه به غیر از نوبت
                    TrafficstiReport["TurnNumber"] = "";
                }

                TrafficstiReport["TrafficNumber"] = "شماره قبض پارکینگ : " + TrafficEntity.TrafficNumber_bint.ToString();

                HPS.BLL.SettingsBLL.BLLSetting_TFactory settingsFactory = new HPS.BLL.SettingsBLL.BLLSetting_TFactory();
                HPS.BLL.SettingsBLL.BLLSetting_T        SettingEntity   = new HPS.BLL.SettingsBLL.BLLSetting_T();
                HPS.BLL.SettingsBLL.BLLSetting_TKeys    SettingKey      = new HPS.BLL.SettingsBLL.BLLSetting_TKeys();
                SettingKey.SettingID_int = 1002;
                SettingEntity            = settingsFactory.GetBy(SettingKey);
                if (TrafficEntity.ServiceID_int == 2)
                {
                    TrafficstiReport["TAllowableHour"] = SettingEntity.Value_nvc; //TrafficEntityrpt.AllowableHour_int.ToString();
                }
                else
                {
                    TrafficstiReport["TAllowableHour"] = TrafficEntity.AllowableHour_int.ToString();
                }



                HPS.BLL.ServicesBLL.BLLServices_TFactory servicesFactory = new HPS.BLL.ServicesBLL.BLLServices_TFactory();
                HPS.BLL.ServicesBLL.BLLServices_TKeys    ServicesKey     = new HPS.BLL.ServicesBLL.BLLServices_TKeys();
                ServicesKey.ServicesID_int = TrafficEntity.ServiceID_int;
                HPS.BLL.ServicesBLL.BLLServices_T ServicesEntity = new HPS.BLL.ServicesBLL.BLLServices_T();
                ServicesEntity = servicesFactory.GetBy(ServicesKey);
                TrafficstiReport["system_nvc"] = " قبض مراجعه به : " + ServicesEntity.ServicesType_nvc;

                if (TrafficEntity.WithLade_bit == true)
                {
                    TrafficstiReport["WithLade_nvc"] = "وضعیت : " + "با بار" + "(" + TrafficEntity.Comment_nvc + ") ";
                }
                else
                {
                    TrafficstiReport["WithLade_nvc"] = "وضعیت : " + "بدون بار";
                }

                if (TrafficEntity.TurnHour_int != null)
                {
                    TrafficstiReport["TurnNumberAllert_nvc"] = " شماره نوبت شما رزرو می باشد لطفاً تا " + TrafficEntity.TurnHour_int.ToString() + " ساعت نسبت به تأیید آن اقدام نمایید";
                }


                TrafficstiReport["InDate_vc"]    = TrafficEntity.Date_nvc;
                TrafficstiReport["InTime_vc"]    = TrafficEntity.Time_nvc;
                TrafficstiReport["Time_vc"]      = PortPlaceFactory.ServerTime;
                TrafficstiReport["Date_vc"]      = PortPlaceFactory.ServerJalaliDate;
                TrafficstiReport["username_nvc"] = HPS.Common.CurrentUser.user.UserName_nvc;


                HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory laderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
                string LaderTypecondition = "[LaderType_T].[LaderTypeID_int]='" + TrafficEntity.LaderTypeID_int + "'";

                TrafficstiReport["@TrafficID_bint"] = TrafficEntity.TrafficID_bint;
                TrafficstiReport["@Condition"]      = LaderTypecondition;
                TrafficstiReport.Render();

                Properties.Settings s = new HPS.Properties.Settings();
                System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings();
                if (string.IsNullOrEmpty(s.PrinterName))
                {
                    TrafficstiReport.Print(true);
                }
                else
                {
                    PrinterSetting.PrinterName = s.PrinterName;
                    TrafficstiReport.Print(false, PrinterSetting);
                }

                this.Close();
            }
            //سواری وغیره
            else if (_Traffic_bit == false && _Othercar_bit == true)
            {
                //HPS.BLL.TrafficBLL.BLLTraffic_T TrafficEntityrpt = new HPS.BLL.TrafficBLL.BLLTraffic_T();
                OtherCarstiReport.Dictionary.Synchronize();
                OtherCarstiReport.Dictionary.Databases.Clear();
                OtherCarstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString));
                OtherCarstiReport.Compile();
                OtherCarstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys()
                {
                    SettingID_int = 1029
                }).Value_nvc.ToString();
                OtherCarstiReport["DateTextBox"]      = TrafficEntity.Date_nvc;
                OtherCarstiReport["TimeTextBox"]      = TrafficEntity.Time_nvc;
                OtherCarstiReport["TrafficNumbertxt"] = TrafficEntity.TrafficNumber_bint.ToString();
                OtherCarstiReport["Servicestxt"]      = " مراجعه به : " + TrafficEntity.Services_nvc;
                OtherCarstiReport["CarTypetxt"]       = "نوع وسیله : " + TrafficEntity.System_nvc;
                HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlateCityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory();
                HPS.BLL.PlateCityBLL.BLLPlateCity_T        PlatecityEntity  = new HPS.BLL.PlateCityBLL.BLLPlateCity_T();
                HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys    PlateCityKey     = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys();
                PlateCityKey.PlateCityID_int = TrafficEntity.PlateCityID_int;
                PlatecityEntity = PlateCityFactory.GetBy(PlateCityKey);
                OtherCarstiReport["NumberPlatetxt"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + PlatecityEntity.PlateCity_nvc + " " + TrafficEntity.SerialPlate_nvc;
                HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();
                if (TrafficEntity.BillMessageID_int == 0 || TrafficEntity.BillMessageID_int == null)
                {
                    OtherCarstiReport["Messagetxt"] = "";
                }
                else
                {
                    string Billcondition = "[BillMessage_T].[BillMessageID_int]=" + TrafficEntity.BillMessageID_int;
                    List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillLst = BillFactory.GetAllByCondition(Billcondition);
                    if (BillLst != null)
                    {
                        OtherCarstiReport["Messagetxt"] = BillLst[0].Message_nvc;
                    }
                    else
                    {
                        OtherCarstiReport["Messagetxt"] = "";
                    }
                }

                NumericTextBox txt = new NumericTextBox();
                txt.DigitsInGroup = 3;
                if (TrafficEntity.Price_dec != null)
                {
                    txt.Text = TrafficEntity.Price_dec.ToString();
                    OtherCarstiReport["Pricetxt"] = " مبلغ دریافتی هنگام ورود " + txt.Text + "  ريال می باشد";
                }
                OtherCarstiReport["AllowableHourtxt"] = TrafficEntity.AllowableHour_int.ToString();
                OtherCarstiReport["ExtraHourtxt"]     = TrafficEntity.ExtraHour_int.ToString();
                txt.Text = TrafficEntity.Fee_dec.ToString();
                OtherCarstiReport["Feetxt"] = txt.Text;
                txt.Text = TrafficEntity.ExtraHourFee_dec.ToString();
                OtherCarstiReport["ExtraHourFeetxt"]      = txt.Text;
                OtherCarstiReport["UserNametxt"]          = TrafficEntity.UserName_nvc;
                OtherCarstiReport["TrafficNumberbarcode"] = TrafficEntity.TrafficNumber_bint.ToString();

                if (TrafficEntity.Printed_bit == true)
                {
                    OtherCarstiReport["txtPrintedAgain"] = "المثنی";
                }
                else
                {
                    OtherCarstiReport["txtPrintedAgain"] = "";
                }

                //DriverName_nvc
                OtherCarstiReport["DriverName_nvc"] = "نام راننده : " + TrafficEntity.FirstName_nvc + " " + TrafficEntity.LastName_nvc;
                OtherCarstiReport["Fee_dec"]        = TrafficEntity.Fee_dec.ToString();
                OtherCarstiReport["PriceTax_dec"]   = TrafficEntity.PriceTax_dec.ToString();
                OtherCarstiReport.Render();

                Properties.Settings s = new HPS.Properties.Settings();
                System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings();
                if (string.IsNullOrEmpty(s.PrinterName))
                {
                    OtherCarstiReport.Print(true);
                }
                else
                {
                    PrinterSetting.PrinterName = s.PrinterName;
                    OtherCarstiReport.Print(false, PrinterSetting);
                }

                this.Close();
            }
            //خارجی
            else if (_Traffic_bit == true && _Othercar_bit == true)
            {
                //HPS.BLL.TrafficBLL.BLLTraffic_T TrafficEntityrpt = new HPS.BLL.TrafficBLL.BLLTraffic_T();
                ForeignCarstiReport.Dictionary.Synchronize();
                ForeignCarstiReport.Dictionary.Databases.Clear();
                ForeignCarstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString));
                ForeignCarstiReport.Compile();
                ForeignCarstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys()
                {
                    SettingID_int = 1029
                }).Value_nvc.ToString();
                ForeignCarstiReport["DateTextBox"]      = TrafficEntity.Date_nvc;
                ForeignCarstiReport["TimeTextBox"]      = TrafficEntity.Time_nvc;
                ForeignCarstiReport["TrafficNumbertxt"] = TrafficEntity.TrafficNumber_bint.ToString();
                ForeignCarstiReport["DriverNametxt"]    = " نام راننده : " + TrafficEntity.FirstName_nvc + " " + TrafficEntity.LastName_nvc;
                HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory laderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
                string LaderTypecondition = "[LaderType_T].[LaderTypeID_int]='" + TrafficEntity.LaderTypeID_int + "'";
                List <HPS.BLL.LaderTypeBLL.BLLLaderType_T> LaderTypeLst = laderTypeFactory.GetAllByCondition(LaderTypecondition);
                if (LaderTypeLst != null)
                {
                    ForeignCarstiReport["CarTypetxt"] = "نوع وسيله : " + TrafficEntity.System_nvc + "-  " + LaderTypeLst[0].LaderType_nvc;
                }
                if (!string.IsNullOrEmpty(TrafficEntity.SerialPlate_nvc))
                {
                    ForeignCarstiReport["NumberPlatetxt"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc) + " - " + TrafficEntity.SerialPlate_nvc;
                }
                else
                {
                    ForeignCarstiReport["NumberPlatetxt"] = "شماره پلاک : " + Hepsa.Core.Common.PersentationController.CorrectNumberPlate(TrafficEntity.NumberPlate_nvc);
                }

                if (TrafficEntity.WithLade_bit == true)
                {
                    ForeignCarstiReport["WithLadetxt"] = "وضعیت : " + "با بار" + "(" + TrafficEntity.Comment_nvc + ") ";
                }
                else
                {
                    ForeignCarstiReport["WithLadetxt"] = "وضعیت : " + "بدون بار";
                }
                NumericTextBox txt = new NumericTextBox();
                txt.DigitsInGroup = 3;
                if (TrafficEntity.Price_dec != null)
                {
                    txt.Text = TrafficEntity.Price_dec.ToString();
                    ForeignCarstiReport["Pricetxt"] = " مبلغ دریافتی هنگام ورود " + txt.Text + "  ريال می باشد";
                }
                ForeignCarstiReport["AllowableHourtxt"] = TrafficEntity.AllowableHour_int.ToString();
                ForeignCarstiReport["ExtraHourtxt"]     = TrafficEntity.ExtraHour_int.ToString();
                txt.Text = TrafficEntity.Fee_dec.ToString();
                ForeignCarstiReport["Feetxt"] = txt.Text;
                txt.Text = TrafficEntity.ExtraHourFee_dec.ToString();
                ForeignCarstiReport["ExtraHourFeetxt"]      = txt.Text;
                ForeignCarstiReport["UserNametxt"]          = TrafficEntity.UserName_nvc;
                ForeignCarstiReport["TrafficNumberbarcode"] = TrafficEntity.TrafficNumber_bint.ToString();
                if (TrafficEntity.Printed_bit == true)
                {
                    ForeignCarstiReport["txtPrintedAgain"] = "المثنی";
                }
                else
                {
                    ForeignCarstiReport["txtPrintedAgain"] = "";
                }
                ForeignCarstiReport["Fee_dec"]      = TrafficEntity.Fee_dec.ToString();
                ForeignCarstiReport["PriceTax_dec"] = TrafficEntity.PriceTax_dec.ToString();
                ForeignCarstiReport.Render();

                Properties.Settings s = new HPS.Properties.Settings();
                System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings();
                if (string.IsNullOrEmpty(s.PrinterName))
                {
                    ForeignCarstiReport.Print(true);
                }
                else
                {
                    PrinterSetting.PrinterName = s.PrinterName;
                    ForeignCarstiReport.Print(false, PrinterSetting);
                }

                this.Close();
            }
            else if (_type == "dublicateTurns")
            {
                BLL.TrafficBLL.BLLTraffic_TFactory trafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                DataTable duplicateTurnDataTable = new DataTable();
                trafficFactory.DuplicateTurnsReport(duplicateTurnDataTable);
                stiViewerControl1.Report = _sti;


                DuplicateTurnsReport.Dictionary.Synchronize();
                DuplicateTurnsReport.Dictionary.Databases.Clear();
                DuplicateTurnsReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString));
                DuplicateTurnsReport.Compile();
                DuplicateTurnsReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys()
                {
                    SettingID_int = 1029
                }).Value_nvc.ToString();
                HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory();
                DuplicateTurnsReport["date_vc"]     = PortPlaceFactory.ServerJalaliDate + "   " + PortPlaceFactory.ServerTime;;
                DuplicateTurnsReport["userName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc;
                DuplicateTurnsReport.Render();
                DuplicateTurnsReport.Show();
            }
            else if (_again == 1)
            {
                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys    LadBillKey           = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys();
                LadBillKey.LadBillCreditID_int = _LadBIillCreditID;
                DataTable LadBillLadeAssignmentDataTable = new DataTable();
                LadBillCreditFactory.GetAllLadeAssignment(LadBillKey, ref LadBillLadeAssignmentDataTable);
                Stimulsoft.Report.StiReport LadBillReportstiReport = new Stimulsoft.Report.StiReport();
                LadBillReportstiReport.Load(Application.StartupPath + "\\LadBillCredit.mrt");
                LadBillReportstiReport.Dictionary.Synchronize();
                LadBillReportstiReport.Dictionary.Databases.Clear();
                LadBillReportstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString));
                LadBillReportstiReport.Compile();
                LadBillReportstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys()
                {
                    SettingID_int = 1029
                }).Value_nvc.ToString();
                if (!string.IsNullOrEmpty(LadBillLadeAssignmentDataTable.Rows[0]["DriverCardNumber_nvc"].ToString()))
                {
                    LadBillReportstiReport["DriverCardNumber_vc"] = " کارت هوشمند راننده: " + LadBillLadeAssignmentDataTable.Rows[0]["DriverCardNumber_nvc"].ToString();
                }
                else
                {
                    LadBillReportstiReport["DriverCardNumber_vc"] = " کارت هوشمند راننده:فاقد كارت ";
                }
                if (!string.IsNullOrEmpty(LadBillLadeAssignmentDataTable.Rows[0]["CarCardNumber_nvc"].ToString()))
                {
                    LadBillReportstiReport["CarCardNumber_vc"] = " کارت هوشمند کامیون : " + LadBillLadeAssignmentDataTable.Rows[0]["CarCardNumber_nvc"].ToString();
                }
                else
                {
                    LadBillReportstiReport["CarCardNumber_vc"] = " کارت هوشمند کامیون :فاقد كارت ";
                }

                LadBillReportstiReport["MobileNumber_vc"]       = string.Format("موبایل راننده: {0}", LadBillLadeAssignmentDataTable.Rows[0]["DriverMobileNumber_nvc"].ToString());
                LadBillReportstiReport["Company_nvc"]           = LadBillLadeAssignmentDataTable.Rows[0]["CompanyID_intCompany_nvc"].ToString() + "(" + LadBillLadeAssignmentDataTable.Rows[0]["CompanyCode_nvc"].ToString() + ")" + "(" + LadBillLadeAssignmentDataTable.Rows[0]["Phone_nvc"].ToString() + ")";                                         //Cmp_nvc
                LadBillReportstiReport["LaderType_nvc"]         = LadBillLadeAssignmentDataTable.Rows[0]["LaderTypeID_intLaderType_nvc"].ToString();
                LadBillReportstiReport["Boxing_nvc"]            = LadBillLadeAssignmentDataTable.Rows[0]["BoxingID_intBoxingType_nvc"].ToString();                                                                                                                                                                                                       //LaderType
                LadBillReportstiReport["PlateNumber_nvc"]       = Hepsa.Core.Common.PersentationController.CorrectNumberPlate(LadBillLadeAssignmentDataTable.Rows[0]["NumberPlate_nvc"].ToString()) + " - " + LadBillLadeAssignmentDataTable.Rows[0]["PlateCity_nvc"].ToString() + LadBillLadeAssignmentDataTable.Rows[0]["SerialPlate_nvc"].ToString(); //Plaque
                LadBillReportstiReport["DriverName_nvc"]        = LadBillLadeAssignmentDataTable.Rows[0]["DriverName"].ToString();                                                                                                                                                                                                                       //Driver
                LadBillReportstiReport["LicenceNumber_bint"]    = (LadBillLadeAssignmentDataTable.Rows[0]["licenceNumber_int"] != DBNull.Value?Convert.ToInt64(LadBillLadeAssignmentDataTable.Rows[0]["licenceNumber_int"]):0);                                                                                                                          //LicenceNumber
                LadBillReportstiReport["LicenceCity_nvc"]       = LadBillLadeAssignmentDataTable.Rows[0]["LicenceCityID_intCity_nvc"].ToString();                                                                                                                                                                                                        //LicenceCity
                LadBillReportstiReport["Good_nvc"]              = LadBillLadeAssignmentDataTable.Rows[0]["GoodID_intGood_nvc"].ToString();                                                                                                                                                                                                               //Good
                LadBillReportstiReport["Date_vc"]               = LadBillLadeAssignmentDataTable.Rows[0]["LadingDate_nvc"].ToString();                                                                                                                                                                                                                   //
                LadBillReportstiReport["Destination_nvc"]       = LadBillLadeAssignmentDataTable.Rows[0]["CityID_intCity_nvc"].ToString() + "-" + LadBillLadeAssignmentDataTable.Rows[0]["Address_nvc"].ToString();
                LadBillReportstiReport["PortajeFee_dec"]        = LadBillLadeAssignmentDataTable.Rows[0]["PortageFee_dec"].ToString();
                LadBillReportstiReport["AssignmentComment_nvc"] = LadBillLadeAssignmentDataTable.Rows[0]["AssignmentComment_nvc"].ToString();
                LadBillReportstiReport["Date_vc"]               = LadBillLadeAssignmentDataTable.Rows[0]["LadBillDate"].ToString();
                LadBillReportstiReport["Time_vc"]               = LadBillLadeAssignmentDataTable.Rows[0]["LadBillTime"].ToString();
                LadBillReportstiReport["TurnNumber_bint"]       = Convert.ToInt64(LadBillLadeAssignmentDataTable.Rows[0]["AcceptedTurnNumber_bint"]);
                LadBillReportstiReport["LadBillNumber_bint"]    = Convert.ToInt64(LadBillLadeAssignmentDataTable.Rows[0]["LadBillCreditID_int"]);
                LadBillReportstiReport["UserName_nvc"]          = LadBillLadeAssignmentDataTable.Rows[0]["LadBillUser"].ToString();
                LadBillReportstiReport["PortPlace_nvc"]         = LadBillLadeAssignmentDataTable.Rows[0]["PortPlaceID_intPortPlaces_nvc"].ToString();
                LadBillReportstiReport["MinWeight_nvc"]         = "از وزن: " + LadBillLadeAssignmentDataTable.Rows[0]["MinWeight_dec"];
                LadBillReportstiReport["MaxWeight_nvc"]         = "تا وزن: " + LadBillLadeAssignmentDataTable.Rows[0]["MaxWeight_dec"];
                LadBillReportstiReport["TrafficNumber_bint"]    = Convert.ToInt64(LadBillLadeAssignmentDataTable.Rows[0]["TrafficNumber_bint"]);
                LadBillReportstiReport["System_nvc"]            = LadBillLadeAssignmentDataTable.Rows[0]["System_nvc"].ToString();
                HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory BillMessage_TFactory = new HPS.BLL.BillMessageBLL.BLLBillMessage_TFactory();
                List <HPS.BLL.BillMessageBLL.BLLBillMessage_T> BillMessage_TList    = new List <HPS.BLL.BillMessageBLL.BLLBillMessage_T>();
                string Condition = string.Format("TrafficType_T.TrafficTypeID_int=9 AND [BillMessage_T].StartDate_nvc<='{0}' AND [BillMessage_T].[EndDate_nvc]>='{0}' ", BillMessage_TFactory.ServerJalaliDate);
                BillMessage_TList = BillMessage_TFactory.GetAllByCondition(Condition);
                if (BillMessage_TList != null && BillMessage_TList.Count > 0)
                {
                    LadBillReportstiReport["BillMessage_nvc"] = BillMessage_TList[0].Message_nvc;
                }
                if (_again != 1)
                {
                    if (LadBillLadeAssignmentDataTable.Rows[0]["LadeDate"].ToString().CompareTo(LadBillCreditFactory.ServerJalaliDate) < 0)
                    {
                        LadBillReportstiReport["Remained_bit"] = true;
                    }
                    else
                    {
                        LadBillReportstiReport["Remained_bit"] = false;
                    }
                }

                if (_again == 1)
                {
                    LadBillReportstiReport["Again_bit"]          = true;
                    LadBillReportstiReport["AgainPrintDate_vc"]  = LadBillCreditFactory.ServerJalaliDate;
                    LadBillReportstiReport["AgainPrintTime_vc"]  = LadBillCreditFactory.ServerTime;
                    LadBillReportstiReport["AgainPrintUser_vnc"] = HPS.Common.CurrentUser.user.UserName_nvc;
                }
                LadBillReportstiReport.Render();
                Properties.Settings s = new HPS.Properties.Settings();
                System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings();
                if (string.IsNullOrEmpty(s.PrinterName))
                {
                    LadBillReportstiReport.PrinterSettings.Copies = 3;
                    LadBillReportstiReport.Print(true);
                }

                else
                {
                    LadBillReportstiReport.PrinterSettings.Copies = 3;
                    PrinterSetting.PrinterName = s.PrinterName;
                    LadBillReportstiReport.Print(false, PrinterSetting);
                }
            }
            else
            {
                stiViewerControl1.Report = _sti;
            }
            this.Close();
        }
コード例 #24
0
        private void LadeAssignmentGridView_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                if (this.LadeAssignmentGridView.CurrentRow == null)
                {
                    return;
                }
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LadeAssignmentKey = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys();
                LadeAssignmentKey.LadeAssignmentID_bint = (Int64?)this.LadeAssignmentGridView.CurrentRow.Cells["colLadeAssignmentID_bint"].Value;
                HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                string condition = "LadBillCredit_T.LadeAssignmentID_bint='" + Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64) + "' or(LadBillCredit_T.LadBillCreditID_int is not null and LadBillCredit_T.Canceled_bit=0 AND LadBillCredit_T.Turn_bit is not NULL)";
                List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T> LadBillCreditList = LadBillCreditFactory.GetAllByCondition(condition);
                int LadBillCreditCount         = 0;
                int canceledLadBillCreditCount = 0;
                if (LadBillCreditList != null && LadBillCreditList.Count > 0)
                {
                    LadBillCreditCount         = LadBillCreditList.Count;
                    canceledLadBillCreditCount = LadBillCreditList.FindAll(itm => itm.Canceled_bit.Value == true).Count;
                }

                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
                List <HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T> LadeAssignmentList    = LadeAssignmentFactory.GetAllBy(HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T.LadeAssignment_TField.LadeAssignmentID_bint, (Int64)LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value);
                int CarCount = (int)Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colCarCount_int.Name].Value, TypeCode.Int32);

                if (LadeAssignmentList != null && LadeAssignmentList.Count > 0)
                {
                    HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory LadeCancelAssignmentFactory = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory();
                    DataTable LadeCancelAssignmentTable = new DataTable();
                    LadeCancelAssignmentFactory.GetAllBy(HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T.LadeCancelAssignment_TField.LadeAssignmentID_bint, LadeAssignmentKey.LadeAssignmentID_bint, ref LadeCancelAssignmentTable);
                    if (LadeCancelAssignmentTable != null && LadeCancelAssignmentTable.Rows.Count > 0)
                    {
                        Int32?Canceled = (from row in LadeCancelAssignmentTable.AsEnumerable() select(Int32) row["Count_int"]).Sum();
                        if (CarCount - LadBillCreditCount - Canceled >= 0)
                        {
                            LadeCancelStripButton.Enabled = true;
                        }
                        else
                        {
                            LadeCancelStripButton.Enabled = false;
                        }
                    }
                    else
                    {
                        if (CarCount - LadBillCreditCount - canceledLadBillCreditCount != 0)
                        {
                            LadeCancelStripButton.Enabled = true;
                        }
                        else
                        {
                            LadeCancelStripButton.Enabled = false;
                        }
                    }
                }

                if (int.Parse(LadeAssignmentGridView.CurrentRow.Cells["colRemainedCar"].Value.ToString()) > 0)
                {
                    LadeCancelStripButton.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #25
0
        private void FillGrid()
        {
            HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeID_intFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
            DataTable LaderTypeID_intDataTable = new DataTable();
            string    laderCondition           = "[LaderType_T].[Active_bit]='true'";

            LaderTypeID_intFactory.GetAllByCondition(laderCondition, ref LaderTypeID_intDataTable);
            laderTypeGrid.SetDataBinding(LaderTypeID_intDataTable, "LaderTypeID_intDataTable");

            HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyID_intFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory();
            string CompanyCondition = "[Company_T].[Active_bit]='true'";

            CompanyID_intFactory.GetAllByCondition(CompanyCondition, ref CompanyID_intDataTable);
            companyGrid.SetDataBinding(CompanyID_intDataTable, "CompanyID_intDataTable");

            HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
            DataTable LadbillOrder1Table = new DataTable();

            LadBillCreditFactory.SelectCompanyRemainedLadBillReportOrderColumns(LadbillOrder1Table);
            DataRow emptyRow1 = LadbillOrder1Table.NewRow();

            LadbillOrder1Table.Rows.InsertAt(emptyRow1, 0);
            this.Order1ComboBox.DisplayMember = "PropertyValue";
            this.Order1ComboBox.ValueMember   = "ColumnName";
            this.Order1ComboBox.DataSource    = LadbillOrder1Table;
            this.Order1ComboBox.SelectedIndex = 0;

            DataTable LadbillOrder2Table = new DataTable();

            LadBillCreditFactory.SelectCompanyRemainedLadBillReportOrderColumns(LadbillOrder2Table);
            DataRow emptyRow2 = LadbillOrder2Table.NewRow();

            LadbillOrder2Table.Rows.InsertAt(emptyRow2, 0);
            this.Order2ComboBox.DisplayMember = "PropertyValue";
            this.Order2ComboBox.ValueMember   = "ColumnName";
            this.Order2ComboBox.DataSource    = LadbillOrder2Table;
            this.Order2ComboBox.SelectedIndex = 0;

            DataTable LadbillOrder3Table = new DataTable();

            LadBillCreditFactory.SelectCompanyRemainedLadBillReportOrderColumns(LadbillOrder3Table);
            DataRow emptyRow3 = LadbillOrder3Table.NewRow();

            LadbillOrder3Table.Rows.InsertAt(emptyRow3, 0);
            this.Order3ComboBox.DisplayMember = "PropertyValue";
            this.Order3ComboBox.ValueMember   = "ColumnName";
            this.Order3ComboBox.DataSource    = LadbillOrder3Table;
            this.Order3ComboBox.SelectedIndex = 0;

            DataTable LadbillOrder4Table = new DataTable();

            LadBillCreditFactory.SelectCompanyRemainedLadBillReportOrderColumns(LadbillOrder4Table);
            DataRow emptyRow4 = LadbillOrder4Table.NewRow();

            LadbillOrder4Table.Rows.InsertAt(emptyRow4, 0);
            this.Order4ComboBox.DisplayMember = "PropertyValue";
            this.Order4ComboBox.ValueMember   = "ColumnName";
            this.Order4ComboBox.DataSource    = LadbillOrder4Table;
            this.Order4ComboBox.SelectedIndex = 0;

            DataTable LadbillOrder5Table = new DataTable();

            LadBillCreditFactory.SelectCompanyRemainedLadBillReportOrderColumns(LadbillOrder5Table);
            DataRow emptyRow5 = LadbillOrder5Table.NewRow();

            LadbillOrder5Table.Rows.InsertAt(emptyRow5, 0);
            this.Order5ComboBox.DisplayMember = "PropertyValue";
            this.Order5ComboBox.ValueMember   = "ColumnName";
            this.Order5ComboBox.DataSource    = LadbillOrder5Table;
            this.Order5ComboBox.SelectedIndex = 0;

            HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory();
            DataTable GoodID_intDataTable = new DataTable();

            GoodFactory.GetAll(ref GoodID_intDataTable);
            goodGrid.SetDataBinding(GoodID_intDataTable, "GoodID_intDataTable");

            HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory();
            DataTable PortPlaceID_intDataTable = new DataTable();
            string    PortPlacesCondition      = "[PortPlaces_T].[Active_bit]='true'";

            PortPlaceFactory.GetAllByCondition(PortPlacesCondition, ref PortPlaceID_intDataTable);
            portPlaceGrid.SetDataBinding(PortPlaceID_intDataTable, "PortPlaceID_intDataTable");

            HPS.BLL.CityBLL.BLLCity_TFactory CityFactory = new HPS.BLL.CityBLL.BLLCity_TFactory();
            DataTable DestinationCityID_intDataTable     = new DataTable();
            string    CityCondition = "[City_T].[Active_bit]='true'";

            CityFactory.GetAllByCondition(CityCondition, ref DestinationCityID_intDataTable);
            destinationCityGrid.SetDataBinding(DestinationCityID_intDataTable, "DestinationCityID_intDataTable");

            this.FromDatefaDatePicker.SelectedDateTime = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(CompanyID_intFactory.ServerJalaliDate);
            this.ToDatefaDatePicker.SelectedDateTime   = FarsiLibrary.Utils.PersianDateConverter.ToGregorianDateTime(CompanyID_intFactory.ServerJalaliDate);
            //FromTimeTextBox.Text = "08:00:00";
            // ToTimeTextBox.Text = CompanyID_intFactory.ServerTime;
        }