Ejemplo n.º 1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory InfractionTypeFactory = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                {
                    return;
                }


                HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory InfractionType_TFactory = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory();
                HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys    InfractionTypeKey       = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys();

                InfractionTypeKey.InfractionTypeID_int = (Int32?)InfractionTypeGridView.CurrentRow.Cells["colInfractionTypeID_int"].Value;
                InfractionTypeFactory.Delete(InfractionTypeKey);

                DataRow[] dr = ((DataTable)this.InfractionTypeGridView.DataSource).Select(HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.InfractionTypeID_int.ToString() + "='" + InfractionTypeKey.InfractionTypeID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.InfractionTypeGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Ejemplo n.º 2
0
        protected override void Delete()
        {
            HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory InfractionTypeFactory = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    InfractionTypeFactory.BeginProc();
                    InfractionTypeFactory.Delete((HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys)Key);
                    InfractionTypeFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.InfractionTypeID_int.ToString() + "='" + ((HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys)Key).InfractionTypeID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                InfractionTypeFactory.RollBackProc();
                throw ex;
            }
        }
Ejemplo n.º 3
0
        protected override void Insert()
        {
            HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory InfractionTypeFactory = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory();
            try
            {
                HPS.BLL.InfractionTypeBLL.BLLInfractionType_T InfractionTypeEntity = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_T();
                InfractionTypeEntity.InfractionType_nvc          = Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionType_nvcTextBox.Text, TypeCode.String).ToString();
                InfractionTypeEntity.InfractionGroupID_int       = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroupID_intComboBox.SelectedValue, TypeCode.Int32);
                InfractionTypeEntity.InfractionSurveyGroupID_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionSurveyGroupID_intComboBox.SelectedValue, TypeCode.Int32);
                InfractionTypeEntity.PenaltyFee_dec = (Nullable <Decimal>)Hepsa.Core.Common.PersentationController.GetEntityValue(PenaltyFee_decNumericTextBox.NumericText, TypeCode.Decimal);
                InfractionTypeEntity.Date_nvc       = InfractionTypeFactory.ServerJalaliDate;
                InfractionTypeEntity.Time_nvc       = InfractionTypeFactory.ServerTime;
                InfractionTypeEntity.UserName_nvc   = HPS.Common.CurrentUser.user.UserName_nvc;
                InfractionTypeEntity.Active_bit     = Active_bitCheckBox.Checked;


                string condition = "InfractionType_T.InfractionType_nvc=N'" + InfractionTypeEntity.InfractionType_nvc + "' AND InfractionType_T.InfractionGroupID_int='" + InfractionTypeEntity.InfractionGroupID_int + "'";
                List <HPS.BLL.InfractionTypeBLL.BLLInfractionType_T> InfractionTypeList = InfractionTypeFactory.GetAllByCondition(condition);
                if (InfractionTypeList != null && InfractionTypeList.Count > 0)
                {
                    throw new ApplicationException("این نوع تخلف قبلاً ثبت شده است");
                }

                InfractionTypeFactory.BeginProc();
                InfractionTypeFactory.Insert(InfractionTypeEntity);
                InfractionTypeFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.InfractionTypeID_int.ToString()]  = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionTypeEntity.InfractionTypeID_int, TypeCode.Int32);
                    dr[HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.InfractionType_nvc.ToString()]    = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionTypeEntity.InfractionType_nvc, TypeCode.String);
                    dr[HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.InfractionGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionTypeEntity.InfractionGroupID_int, TypeCode.Int32);
                    dr["InfractionGroupID_intInfractionGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(InfractionGroupID_intComboBox);
                    dr[HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.InfractionSurveyGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionTypeEntity.InfractionSurveyGroupID_int, TypeCode.Int32);
                    dr["InfractionSurveyGroupID_intInfractionSurveyGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(InfractionSurveyGroupID_intComboBox);
                    dr[HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.PenaltyFee_dec.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionTypeEntity.PenaltyFee_dec, TypeCode.Decimal);
                    dr[HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.Date_nvc.ToString()]       = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionTypeEntity.Date_nvc, TypeCode.String);
                    dr[HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.Time_nvc.ToString()]       = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionTypeEntity.Time_nvc, TypeCode.String);
                    dr[HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.Active_bit.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionTypeEntity.Active_bit, TypeCode.Boolean);
                    dr[HPS.BLL.InfractionTypeBLL.BLLInfractionType_T.InfractionType_TField.UserName_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionTypeEntity.UserName_nvc, TypeCode.String);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                InfractionTypeFactory.RollBackProc();
                throw ex;
            }
        }
Ejemplo n.º 4
0
 private void LoadInfractionType()
 {
     try
     {
         HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory InfractionTypeFactory = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory();
         DataTable InfractionTypeDataTable = new DataTable();
         InfractionTypeFactory.GetAll(ref InfractionTypeDataTable);
         this.InfractionTypeGridView.DataSource = InfractionTypeDataTable;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 5
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory InfractionTypeFactory = new HPS.BLL.InfractionTypeBLL.BLLInfractionType_TFactory();
     HPS.BLL.InfractionTypeBLL.BLLInfractionType_T        InfractionTypeEntity  = InfractionTypeFactory.GetBy((HPS.BLL.InfractionTypeBLL.BLLInfractionType_TKeys)Key);
     if (InfractionTypeEntity == null)
     {
         throw new HPS.Exceptions.InfractionTypeNotFound();
     }
     InfractionType_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionTypeEntity.InfractionType_nvc, TypeCode.String));
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref InfractionGroupID_intComboBox, InfractionTypeEntity.InfractionGroupID_int, TypeCode.Int32);
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref InfractionSurveyGroupID_intComboBox, InfractionTypeEntity.InfractionSurveyGroupID_int, TypeCode.Int32);
     PenaltyFee_decNumericTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionTypeEntity.PenaltyFee_dec, TypeCode.Decimal));
     Active_bitCheckBox.Checked        = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionTypeEntity.Active_bit, TypeCode.Boolean);
 }