Exemple #1
0
        private void ShowButton_Click(object sender, EventArgs e)
        {
            DataTable ReportDataTable = new DataTable();

            HPS.BLL.Reports.LadBillReportBLL LadBillReportEntity = new HPS.BLL.Reports.LadBillReportBLL();
            LadBillReportEntity.CompanyID_nvc          = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyID_intComboBox.SelectedValue, TypeCode.String);
            LadBillReportEntity.DriverCardNumber_nvc   = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(DriverCardNumber_bintNumericTextBox.NumericText, TypeCode.String);
            LadBillReportEntity.CarCardNumber_nvc      = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(CarCardNumber_nvcTextBox.Text, TypeCode.String);
            LadBillReportEntity.CityID_nvc             = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(CityID_intComboBox.SelectedValue, TypeCode.String);
            LadBillReportEntity.LaderTypeID_nvc        = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(LaderTypeID_intComboBox.SelectedValue, TypeCode.String);
            LadBillReportEntity.BoxingID_nvc           = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingID_intComboBox.SelectedValue, TypeCode.String);
            LadBillReportEntity.GoodID_nvc             = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(GoodID_intComboBox.SelectedValue, TypeCode.String);
            LadBillReportEntity.TrafficTypeID_nvc      = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficTypeID_intComboBox.SelectedValue, TypeCode.String);
            LadBillReportEntity.AnnouncementTimeID_nvc = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(AnnouncementTimeID_intComboBox.SelectedValue, TypeCode.String);
            LadBillReportEntity.FromSerial_nvc         = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(FromSerial_nvcTextBox.Text, TypeCode.String);
            LadBillReportEntity.ToSerial_nvc           = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(ToSerial_nvcTextBox.Text, TypeCode.String);
            LadBillReportEntity.FromLadBillNumber_int  = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(FromLadBillNumber_intNumericTextBox.NumericText, TypeCode.Int32);
            LadBillReportEntity.ToLadBillNumber_int    = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(ToLadBillNumber_intNumericTextBox.NumericText, TypeCode.Int32);
            LadBillReportEntity.PortPlaceID_nvc        = (string)Hepsa.Core.Common.PersentationController.GetEntityValue(PortPlaceID_intComboBox.SelectedValue, TypeCode.String);
            LadBillReportEntity.FromLadingDate_nvc     = FromLadingDatePicker.Text;
            LadBillReportEntity.ToLadingDate_nvc       = ToLadingDatePicker.Text;
            LadBillReportEntity.FromLadingTime_nvc     = Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromLadingTime_nvcTextBox);
            LadBillReportEntity.FromLadBillDate_nvc    = FromLadBillDatePicker.Text;
            LadBillReportEntity.ToLadBillDate_nvc      = ToLadingDatePicker.Text;
            LadBillReportEntity.FromLadBillTime_nvc    = Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromLadBillTime_nvc);
            LadBillReportEntity.ToLadBillTime_nvc      = Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToLadBillTime_nvc);
            HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory ReportFactory = new HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory();

            ReportFactory.SelectReport(LadBillReportEntity, ref ReportDataTable);
            ReportGrid.SetDataBinding(ReportDataTable, "ReportDataTable");
            this.tabControl1.SelectedTab = this.ReportTabPage;
        }
Exemple #2
0
        protected override void Delete()
        {
            HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory UsedLadBillFactory = new HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    UsedLadBillFactory.BeginProc();
                    UsedLadBillFactory.Delete((HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TKeys)Key);
                    UsedLadBillFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T.UsedLadBill_TField.UsedLadBillID_int.ToString() + "='" + ((HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TKeys)Key).UsedLadBillID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                UsedLadBillFactory.RollBackProc();
                throw ex;
            }
        }
Exemple #3
0
        protected override void Insert()
        {
            HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory UsedLadBillFactory = new HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory();
            try
            {
                HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T UsedLadBillEntity = new HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T();
                UsedLadBillEntity.Serial_nvc            = Hepsa.Core.Common.PersentationController.GetEntityValue(Serial_nvcTextBox.Text, TypeCode.String).ToString();
                UsedLadBillEntity.LadBillNumber_int     = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillNumber_intNumericTextBox.NumericText, TypeCode.Int32);
                UsedLadBillEntity.Comment_nvc           = Hepsa.Core.Common.PersentationController.GetEntityValue(Comment_nvcTextBox.Text, TypeCode.String).ToString();
                UsedLadBillEntity.Date_nvc              = UsedLadBillFactory.ServerJalaliDate;
                UsedLadBillEntity.Time_nvc              = UsedLadBillFactory.ServerTime;
                UsedLadBillEntity.UserName_nvc          = HPS.Common.CurrentUser.user.UserName_nvc;
                UsedLadBillEntity.LadBillCreditID_int   = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillCreditKey.LadBillCreditID_int, TypeCode.Int32);
                UsedLadBillEntity.CompanyLadBillID_bint = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(_CompanyLadBillKey.CompanyLadBillID_bint, TypeCode.Int64);

                ////Check if number exist
                List <HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T> UsedLadBillList = UsedLadBillFactory.GetAllBy(HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T.UsedLadBill_TField.LadBillNumber_int, UsedLadBillEntity.LadBillNumber_int);
                if (UsedLadBillList.Count > 0)
                {
                    throw new ApplicationException("این شماره قبلاً اختصاص داده شده است");
                }

                string CompanyLadBilCondition = "[CompanyLadBill_T].[StartNumber_int]<=N'" + UsedLadBillEntity.LadBillNumber_int + "' and [CompanyLadBill_T].[EndNumber_int]>=N'" + UsedLadBillEntity.LadBillNumber_int + "' AND [CompanyLadBill_T].[Serial_nvc]='" + Serial_nvcTextBox.Text + "'";
                HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory CompanyLadBillFactory = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory();
                List <HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T> CompanyLadBillList    = CompanyLadBillFactory.GetAllByCondition(CompanyLadBilCondition);
                if (CompanyLadBillList.Count == 0)
                {
                    throw new ApplicationException("این شماره مابین شماره های اختصاص داده شده به شرکت نمی باشد");
                }
                UsedLadBillFactory.BeginProc();
                UsedLadBillFactory.Insert(UsedLadBillEntity);
                UsedLadBillFactory.CommitProc();

                if (this._LadBillWithTrafficDataTable != null)
                {
                    DataRow[] dr = this._LadBillWithTrafficDataTable.Select("LadBillCreditID_int=" + Convert.ToString(LadBillCreditKey.LadBillCreditID_int));
                    if (dr != null && dr.Length > 0)
                    {
                        dr[0].Delete();
                        this._LadBillWithTrafficDataTable.AcceptChanges();
                    }
                }

                LadBillNumber_intNumericTextBox.Text = string.Empty;
                Comment_nvcTextBox.Text = string.Empty;
            }
            catch (Exception ex)
            {
                UsedLadBillFactory.RollBackProc();
                throw ex;
            }
        }
Exemple #4
0
        private void UsedLadBillToolStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.LadBillWithTrafficGridView.CurrentRow != null && CompanyLadBillGridView.CurrentRow != null)
                {
                    if (this.LadBillWithTrafficGridView.CurrentRow.Cells["LadBillCreditID_int"].Value != null && this.CompanyLadBillGridView.CurrentRow.Cells["CompanyLadBillID_bint"].Value != null)
                    {
                        HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T UsedLadBillEntity = new HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T();
                        UsedLadBillEntity.LadBillCreditID_int = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadBillWithTrafficGridView.CurrentRow.Cells["LadBillCreditID_int"].Value, TypeCode.Int32);
                        HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys CompanyLadBillKey = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys();
                        CompanyLadBillKey.CompanyLadBillID_bint = (Int64)this.CompanyLadBillGridView.CurrentRow.Cells["CompanyLadBillID_bint"].Value;
                        //////////////

                        HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory CompanyLaddBillFactory = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory();
                        HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T        CompanyLadBillEntity   = CompanyLaddBillFactory.GetBy((HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys)CompanyLadBillKey);

                        HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory UsedLadBillFactory = new HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory();
                        string    Condition             = "(CompanyLadBill_T.StartNumber_int=N'" + CompanyLadBillEntity.StartNumber_int + "') AND (UsedLadBill_T.Serial_nvc =N'" + CompanyLadBillEntity.Serial_nvc + "') ";
                        DataTable LadBillCountDataTable = new DataTable();
                        UsedLadBillFactory.GetCountByCondition(Condition, ref LadBillCountDataTable);
                        int LadBillCount = 0;
                        if (LadBillCountDataTable != null && LadBillCountDataTable.Rows.Count > 0)
                        {
                            LadBillCount = Convert.ToInt32(LadBillCountDataTable.Rows[0]["UsedLadbBillCount"].ToString());
                        }
                        int Count = (CompanyLadBillEntity.EndNumber_int - CompanyLadBillEntity.StartNumber_int);
                        if (!(Count - LadBillCount > 0))
                        {
                            throw new ApplicationException("تعداد بارنامه های داده شده به این شرکت به اتمام رسیده است");
                        }
                        else
                        {
                            UsedLadBillEntityForm UsedLadBill = new UsedLadBillEntityForm((DataTable)this.CompanyLadBillGridView.DataSource, (DataTable)LadBillWithTrafficGridView.DataSource, UsedLadBillEntity.LadBillCreditID_int, CompanyLadBillKey, Convert.ToString(this.LadBillWithTrafficGridView.CurrentRow.Cells["DriverName"].Value), Convert.ToString(this.LadBillWithTrafficGridView.CurrentRow.Cells["NumberPlate"].Value));
                            UsedLadBill.ShowDialog();
                        }
                    }
                    //LoadAllLadBill();
                }
                else
                {
                    throw new ApplicationException("اطلاع رسانی بار و اختصاص بارنامه مربوط خالی است");
                }
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Exemple #5
0
        protected override void Edit()
        {
            HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory UsedLadBillFactory = new HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory();
            try
            {
                HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T UsedLadBillEntity = new HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T();
                UsedLadBillEntity.Serial_nvc            = Hepsa.Core.Common.PersentationController.GetEntityValue(Serial_nvcTextBox.Text, TypeCode.String).ToString();
                UsedLadBillEntity.LadBillNumber_int     = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillNumber_intNumericTextBox.NumericText, TypeCode.Int32);
                UsedLadBillEntity.Comment_nvc           = Hepsa.Core.Common.PersentationController.GetEntityValue(Comment_nvcTextBox.Text, TypeCode.String).ToString();
                UsedLadBillEntity.Date_nvc              = UsedLadBillFactory.ServerJalaliDate;
                UsedLadBillEntity.Time_nvc              = UsedLadBillFactory.ServerTime;
                UsedLadBillEntity.UserName_nvc          = HPS.Common.CurrentUser.user.UserName_nvc;
                UsedLadBillEntity.LadBillCreditID_int   = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillCreditKey.LadBillCreditID_int, TypeCode.Int64);
                UsedLadBillEntity.CompanyLadBillID_bint = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(_CompanyLadBillKey.CompanyLadBillID_bint, TypeCode.Int64);

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    UsedLadBillFactory.BeginProc();
                    UsedLadBillFactory.Update(UsedLadBillEntity, (HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TKeys)Key);
                    UsedLadBillFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T.UsedLadBill_TField.UsedLadBillID_int.ToString() + "='" + ((HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TKeys)Key).UsedLadBillID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T.UsedLadBill_TField.Serial_nvc.ToString()]        = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UsedLadBillEntity.Serial_nvc, TypeCode.String);
                            dr[0][HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T.UsedLadBill_TField.LadBillNumber_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UsedLadBillEntity.LadBillNumber_int, TypeCode.Int32);
                            dr[0][HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T.UsedLadBill_TField.Comment_nvc.ToString()]       = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UsedLadBillEntity.Comment_nvc, TypeCode.String);
                            dr[0][HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T.UsedLadBill_TField.Date_nvc.ToString()]          = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UsedLadBillEntity.Date_nvc, TypeCode.String);
                            dr[0][HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T.UsedLadBill_TField.Time_nvc.ToString()]          = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UsedLadBillEntity.Time_nvc, TypeCode.String);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                UsedLadBillFactory.RollBackProc();
                throw ex;
            }
        }