Example #1
0
        protected override void Delete()
        {
            HPS.BLL.StopFeeBLL.BLLStopFee_TFactory StopFeeFactory = new HPS.BLL.StopFeeBLL.BLLStopFee_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    StopFeeFactory.BeginProc();
                    StopFeeFactory.Delete((HPS.BLL.StopFeeBLL.BLLStopFee_TKeys)Key);
                    StopFeeFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.StopFeeID_int.ToString() + "='" + ((HPS.BLL.StopFeeBLL.BLLStopFee_TKeys)Key).StopFeeID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                StopFeeFactory.RollBackProc();
                throw ex;
            }
        }
Example #2
0
        protected override void Insert()
        {
            HPS.BLL.StopFeeBLL.BLLStopFee_TFactory StopFeeFactory = new HPS.BLL.StopFeeBLL.BLLStopFee_TFactory();
            try
            {
                HPS.BLL.StopFeeBLL.BLLStopFee_T StopFeeEntity = new HPS.BLL.StopFeeBLL.BLLStopFee_T();
                StopFeeEntity.AllowedHoure_int               = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(AllowedHoure_intNumericTextBox.NumericText, TypeCode.Int32);
                StopFeeEntity.Fee_dec                        = (Decimal)Hepsa.Core.Common.PersentationController.GetEntityValue(Fee_decNumericTextBox.NumericText, TypeCode.Decimal);
                StopFeeEntity.ExtraHour_int                  = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(ExtraHour_intNumericTextBox.NumericText, TypeCode.Int32);
                StopFeeEntity.ExtraHourFee_dec               = (Nullable <Decimal>)Hepsa.Core.Common.PersentationController.GetEntityValue(ExtraHourFee_decNumericTextBox.NumericText, TypeCode.Decimal);
                StopFeeEntity.WithLadeExtraHourFee_dec       = (Nullable <Decimal>)Hepsa.Core.Common.PersentationController.GetEntityValue(WithLadeExtraHourFee_decNumericTextBox.NumericText, TypeCode.Decimal);
                StopFeeEntity.TrafficTypeID_int              = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficTypeID_intComboBox.SelectedValue, TypeCode.Int32);
                StopFeeEntity.LaderPivotGroupID_int          = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(LaderPivotGroupID_intComboBox.SelectedValue, TypeCode.Int32);
                StopFeeEntity.ServicesID_int                 = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(ServicesID_intComboBox.SelectedValue, TypeCode.Int32);
                StopFeeEntity.Tax_bit                        = Tax_bitcheckBox.Checked;
                StopFeeEntity.TurnNotLadBillExtraHour_int    = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnNotLadBillExtraHour_intTextBox.Text, TypeCode.Int32);
                StopFeeEntity.TurnNotLadBillExtraHourFee_dec = (Nullable <Decimal>)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnNotLadBillExtraHourFee_decTextBox.NumericText, TypeCode.Decimal);
                if (StartDate_nvcTextBox.Enabled && StartDate_nvcTextBox.Text.CompareTo(StopFeeFactory.ServerJalaliDate) < 0)
                {
                    throw new ApplicationException("تاریخ شروع نمی تواند کوچکتر از تاریخ جاری باشد");
                }

                if (EndDate_nvcTextBox.Enabled && EndDate_nvcTextBox.Text.CompareTo(StopFeeFactory.ServerJalaliDate) < 0)
                {
                    throw new ApplicationException("تاریخ اتمام نمی تواند کوچکتر از تاریخ جاری باشد");
                }//, StopFeeEntity.ServicesID_int.HasValue ? StopFeeEntity.ServicesID_int.ToString() : "NULL"  AND StopFee_T.ServicesID_int='{3}'
                string Condition = string.Empty;
                if (StopFeeEntity.WithLadeExtraHourFee_dec.HasValue == false)
                {
                    Condition = string.Format("StopFee_T.TrafficTypeID_int='{0}' And StopFee_T.LaderPivotGroupID_int='{1}' AND StopFee_T.WithLadeExtraHourFee_dec is NULL ", StopFeeEntity.TrafficTypeID_int, StopFeeEntity.LaderPivotGroupID_int);
                }
                else
                {
                    Condition = string.Format("StopFee_T.TrafficTypeID_int='{0}' And StopFee_T.LaderPivotGroupID_int='{1}' AND StopFee_T.WithLadeExtraHourFee_dec is not null ", StopFeeEntity.TrafficTypeID_int, StopFeeEntity.LaderPivotGroupID_int);
                }
                if (StopFeeEntity.ExtraHourFee_dec.HasValue)
                {
                    Condition += string.Format(" AND StopFee_T.ExtraHourFee_dec IS NOT Null");
                }
                else
                {
                    Condition += string.Format(" AND StopFee_T.ExtraHourFee_dec Is Null ");
                }
                if (StopFeeEntity.ServicesID_int.HasValue == false)
                {
                    Condition += " AND StopFee_T.ServicesID_int Is Null";
                }
                else
                {
                    Condition += string.Format(" AND StopFee_T.ServicesID_int={0}", StopFeeEntity.ServicesID_int);
                }

                List <HPS.BLL.StopFeeBLL.BLLStopFee_T> StopFeeDateList = StopFeeFactory.GetAllByCondition(Condition);
                if (StopFeeDateList != null && StopFeeDateList.Count > 0)
                {
                    foreach (HPS.BLL.StopFeeBLL.BLLStopFee_T item in StopFeeDateList)
                    {
                        if (!(StartDate_nvcTextBox.Text.CompareTo(item.EndDate_nvc) > 0 || EndDate_nvcTextBox.Text.CompareTo(item.StartDate_nvc) < 0))
                        {
                            throw new ApplicationException("براي تاريخ وارد شده حق پاركينگ تعريف شده است");
                        }
                    }
                }

                StopFeeEntity.StartDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(StartDate_nvcTextBox.Text, TypeCode.String).ToString();
                StopFeeEntity.EndDate_nvc   = Hepsa.Core.Common.PersentationController.GetEntityValue(EndDate_nvcTextBox.Text, TypeCode.String).ToString();
                StopFeeEntity.Date_nvc      = StopFeeFactory.ServerJalaliDate;
                StopFeeEntity.Time_nvc      = StopFeeFactory.ServerTime;
                StopFeeEntity.UserName_nvc  = HPS.Common.CurrentUser.user.UserName_nvc;

                StopFeeFactory.BeginProc();
                StopFeeFactory.Insert(StopFeeEntity);
                StopFeeFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.StopFeeID_int.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.StopFeeID_int, TypeCode.Int32);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.AllowedHoure_int.ToString()]  = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.AllowedHoure_int, TypeCode.Int32);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.Fee_dec.ToString()]           = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.Fee_dec, TypeCode.Decimal);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.ExtraHour_int.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.ExtraHour_int, TypeCode.Int32);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.ExtraHourFee_dec.ToString()]  = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.ExtraHourFee_dec, TypeCode.Decimal);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.TrafficTypeID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.TrafficTypeID_int, TypeCode.Int32);
                    dr["TrafficTypeID_intTrafficType_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(TrafficTypeID_intComboBox);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.LaderPivotGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.LaderPivotGroupID_int, TypeCode.Int32);
                    dr["LaderPivotGroupID_intLaderPivotGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(LaderPivotGroupID_intComboBox);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.StartDate_nvc.ToString()]            = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.StartDate_nvc, TypeCode.String);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.EndDate_nvc.ToString()]              = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.EndDate_nvc, TypeCode.String);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.Date_nvc.ToString()]                 = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.Date_nvc, TypeCode.String);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.Time_nvc.ToString()]                 = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.Time_nvc, TypeCode.String);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.UserName_nvc.ToString()]             = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.UserName_nvc, TypeCode.String);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.WithLadeExtraHourFee_dec.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.WithLadeExtraHourFee_dec, TypeCode.Decimal);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.ServicesID_int.ToString()]           = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.ServicesID_int, TypeCode.Int32);
                    dr["ServicesID_intServicesType_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(ServicesID_intComboBox);
                    dr["Tax_bit"] = Hepsa.Core.Common.PersentationController.GetCheckBoxValue(Tax_bitcheckBox.Checked);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.TurnNotLadBillExtraHour_int.ToString()]    = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.TurnNotLadBillExtraHour_int, TypeCode.Int32);
                    dr[HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.TurnNotLadBillExtraHourFee_dec.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.TurnNotLadBillExtraHourFee_dec, TypeCode.Decimal);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                StopFeeFactory.RollBackProc();
                throw ex;
            }
        }
Example #3
0
        protected override void Edit()
        {
            HPS.BLL.StopFeeBLL.BLLStopFee_TFactory StopFeeFactory = new HPS.BLL.StopFeeBLL.BLLStopFee_TFactory();
            try
            {
                HPS.BLL.StopFeeBLL.BLLStopFee_T StopFeeEntity = new HPS.BLL.StopFeeBLL.BLLStopFee_T();
                StopFeeEntity.AllowedHoure_int      = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(AllowedHoure_intNumericTextBox.NumericText, TypeCode.Int32);
                StopFeeEntity.Fee_dec               = (Decimal)Hepsa.Core.Common.PersentationController.GetEntityValue(Fee_decNumericTextBox.NumericText, TypeCode.Decimal);
                StopFeeEntity.ExtraHour_int         = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(ExtraHour_intNumericTextBox.NumericText, TypeCode.Int32);
                StopFeeEntity.ExtraHourFee_dec      = (Nullable <Decimal>)Hepsa.Core.Common.PersentationController.GetEntityValue(ExtraHourFee_decNumericTextBox.NumericText, TypeCode.Decimal);
                StopFeeEntity.TrafficTypeID_int     = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficTypeID_intComboBox.SelectedValue, TypeCode.Int32);
                StopFeeEntity.LaderPivotGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(LaderPivotGroupID_intComboBox.SelectedValue, TypeCode.Int32);
                StopFeeEntity.ServicesID_int        = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(ServicesID_intComboBox.SelectedValue, TypeCode.Int32);
                StopFeeEntity.Tax_bit               = Tax_bitcheckBox.Checked;
                if (StartDate_nvcTextBox.Enabled && StartDate_nvcTextBox.Text.CompareTo(StopFeeFactory.ServerJalaliDate) < 0)
                {
                    throw new ApplicationException("تاریخ شروع نمی تواند کوچکتر از تاریخ جاری باشد");
                }

                if (EndDate_nvcTextBox.Enabled && EndDate_nvcTextBox.Text.CompareTo(StopFeeFactory.ServerJalaliDate) < 0)
                {
                    throw new ApplicationException("تاریخ اتمام نمی تواند کوچکتر از تاریخ جاری باشد");
                }
                string Condition = string.Format("StopFee_T.TrafficTypeID_int='{0}' And StopFee_T.LaderPivotGroupID_int='{1}' And StopFee_T.StopFeeID_int<>{2} AND StopFee_T.WithLadeExtraHourFee_dec={3}  AND StopFee_T.ServicesID_int={4}", StopFeeEntity.TrafficTypeID_int, StopFeeEntity.LaderPivotGroupID_int, ((HPS.BLL.StopFeeBLL.BLLStopFee_TKeys)Key).StopFeeID_int.ToString(), StopFeeEntity.WithLadeExtraHourFee_dec.HasValue ? StopFeeEntity.WithLadeExtraHourFee_dec.ToString() : "NULL", StopFeeEntity.ServicesID_int.HasValue?StopFeeEntity.ServicesID_int.ToString():"NULL");
                List <HPS.BLL.StopFeeBLL.BLLStopFee_T> StopFeeDateList = StopFeeFactory.GetAllByCondition(Condition);
                if (StopFeeDateList != null && StopFeeDateList.Count > 0)
                {
                    foreach (HPS.BLL.StopFeeBLL.BLLStopFee_T item in StopFeeDateList)
                    {
                        if (!(StartDate_nvcTextBox.Text.CompareTo(item.EndDate_nvc) > 0 || EndDate_nvcTextBox.Text.CompareTo(item.StartDate_nvc) < 0))
                        {
                            throw new ApplicationException("براي تاريخ وارد شده حق پاركينگ تعريف شده است");
                        }
                    }
                }
                StopFeeEntity.TurnNotLadBillExtraHour_int    = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnNotLadBillExtraHour_intTextBox.Text, TypeCode.Int32);
                StopFeeEntity.TurnNotLadBillExtraHourFee_dec = (Nullable <Decimal>)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnNotLadBillExtraHourFee_decTextBox.NumericText, TypeCode.Decimal);

                StopFeeEntity.StartDate_nvc            = Hepsa.Core.Common.PersentationController.GetEntityValue(StartDate_nvcTextBox.Text, TypeCode.String).ToString();
                StopFeeEntity.EndDate_nvc              = Hepsa.Core.Common.PersentationController.GetEntityValue(EndDate_nvcTextBox.Text, TypeCode.String).ToString();
                StopFeeEntity.Date_nvc                 = StopFeeFactory.ServerJalaliDate;
                StopFeeEntity.Time_nvc                 = StopFeeFactory.ServerTime;
                StopFeeEntity.UserName_nvc             = HPS.Common.CurrentUser.user.UserName_nvc;
                StopFeeEntity.WithLadeExtraHourFee_dec = (Nullable <Decimal>)Hepsa.Core.Common.PersentationController.GetEntityValue(WithLadeExtraHourFee_decNumericTextBox.NumericText, TypeCode.Decimal);

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    StopFeeFactory.BeginProc();
                    StopFeeFactory.Update(StopFeeEntity, (HPS.BLL.StopFeeBLL.BLLStopFee_TKeys)Key);
                    StopFeeFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.StopFeeID_int.ToString() + "='" + ((HPS.BLL.StopFeeBLL.BLLStopFee_TKeys)Key).StopFeeID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.AllowedHoure_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.AllowedHoure_int, TypeCode.Int32);
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.Fee_dec.ToString()]          = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.Fee_dec, TypeCode.Decimal);
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.ExtraHour_int.ToString()]    = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.ExtraHour_int, TypeCode.Int32);
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.ExtraHourFee_dec.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.ExtraHourFee_dec, TypeCode.Decimal);
                            dr[0]["TrafficTypeID_intTrafficType_nvc"]         = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(TrafficTypeID_intComboBox);
                            dr[0]["LaderPivotGroupID_intLaderPivotGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(LaderPivotGroupID_intComboBox);
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.StartDate_nvc.ToString()]            = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.StartDate_nvc, TypeCode.String);
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.EndDate_nvc.ToString()]              = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.EndDate_nvc, TypeCode.String);
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.Date_nvc.ToString()]                 = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.Date_nvc, TypeCode.String);
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.Time_nvc.ToString()]                 = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.Time_nvc, TypeCode.String);
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.WithLadeExtraHourFee_dec.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.WithLadeExtraHourFee_dec, TypeCode.Decimal);
                            dr[0]["ServicesID_intServicesType_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(ServicesID_intComboBox);
                            dr[0]["Tax_bit"] = Hepsa.Core.Common.PersentationController.GetCheckBoxValue(Tax_bitcheckBox.Checked);
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.TurnNotLadBillExtraHour_int.ToString()]    = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.TurnNotLadBillExtraHour_int, TypeCode.Int32);
                            dr[0][HPS.BLL.StopFeeBLL.BLLStopFee_T.StopFee_TField.TurnNotLadBillExtraHourFee_dec.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(StopFeeEntity.TurnNotLadBillExtraHourFee_dec, TypeCode.Decimal);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                StopFeeFactory.RollBackProc();
                throw ex;
            }
        }