Esempio n. 1
0
        public void PopulateBusinessObjectFromReader(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T businessObject, IDataReader dataReader)
        {
            businessObject.MessageRecipientID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.MessageRecipientID_int.ToString()));
            businessObject.MessageID_bint         = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.MessageID_bint.ToString()));
            businessObject.UserGroupID_int        = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.UserGroupID_int.ToString()));
            businessObject.StartDate_nvc          = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.StartDate_nvc.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.EndDate_nvc.ToString())) == false)
            {
                businessObject.EndDate_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.EndDate_nvc.ToString()));
            }
            else
            {
                businessObject.EndDate_nvc = String.Empty;
            }

            businessObject.Date_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.Date_nvc.ToString()));
            businessObject.Time_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.Time_nvc.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.UserName_nvc.ToString())) == false)
            {
                businessObject.UserName_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.UserName_nvc.ToString()));
            }
            else
            {
                businessObject.UserName_nvc = String.Empty;
            }
        }
Esempio n. 2
0
        public void Update(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T businessObject, HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.MessageRecipientID_int == businessObjectKey.MessageRecipientID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueMessageRecipientID_int") == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }
                else
                {
                    if (businessObject.IsValid() == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }

                _dataObject.Update(businessObject, businessObjectKey);
            }
            catch (System.Exception ex)
            {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Esempio n. 3
0
        public HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T SelectByPrimaryKey(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_MessageRecipient_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter MessageRecipientID_int = new SqlParameter();
                MessageRecipientID_int.ParameterName = "@MessageRecipientID_int";
                MessageRecipientID_int.SqlDbType     = SqlDbType.Int;
                MessageRecipientID_int.Direction     = ParameterDirection.Input;
                MessageRecipientID_int.IsNullable    = false;
                MessageRecipientID_int.Value         = businessObjectKey.MessageRecipientID_int;
                this.Command.Parameters.Add(MessageRecipientID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T businessObject = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T();
                if (dataReader.Read())
                {
                    PopulateBusinessObjectFromReader(businessObject, dataReader);
                }
                else
                {
                    businessObject = null;
                }

                if (dataReader.IsClosed == false)
                {
                    dataReader.Close();
                }


                if (ControlConnection)
                {
                    this.Commit();
                }
                return(businessObject);
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Esempio n. 4
0
        public List <HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T> list = new List <HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T>();

            while (dataReader.Read())
            {
                HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T businessObject = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Esempio n. 5
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TFactory MessageRecipientFactory = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TFactory();
     HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T        MessageRecipientEntity  = MessageRecipientFactory.GetBy((HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys)Key);
     if (MessageRecipientEntity == null)
     {
         throw new HPS.Exceptions.MessageRecipientNotFound();
     }
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref MessageID_bintComboBox, MessageRecipientEntity.MessageID_bint, TypeCode.Int64);
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref UserGroupID_intComboBox, MessageRecipientEntity.UserGroupID_int, TypeCode.Int32);
     MessageRecipientEntity.UserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc;
 }
Esempio n. 6
0
        public void Insert(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "MessageRecipientID_int") == false)
                {
                    throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                }

                _dataObject.Insert(businessObject);
            }
            catch (System.Exception ex)
            {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Esempio n. 7
0
        protected override void Insert()
        {
            HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TFactory MessageRecipientFactory = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TFactory();

            try
            {
                HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T MessageRecipientEntity = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T();
                MessageRecipientEntity.MessageID_bint  = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(MessageID_bintComboBox.SelectedValue, TypeCode.Int64);
                MessageRecipientEntity.UserGroupID_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(UserGroupID_intComboBox.SelectedValue, TypeCode.Int32);
                MessageRecipientEntity.Date_nvc        = MessageRecipientFactory.ServerJalaliDate;
                MessageRecipientEntity.Time_nvc        = MessageRecipientFactory.ServerTime;

                MessageRecipientFactory.BeginProc();
                MessageRecipientFactory.Insert(MessageRecipientEntity);
                MessageRecipientFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.MessageRecipientID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageRecipientEntity.MessageRecipientID_int, TypeCode.Int32);
                    dr[HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.MessageID_bint.ToString()]         = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageRecipientEntity.MessageID_bint, TypeCode.Int64);
                    dr["MessageID_bintMessageTitle_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(MessageID_bintComboBox);
                    dr[HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.UserGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageRecipientEntity.UserGroupID_int, TypeCode.Int32);
                    dr["UserGroupID_intUserGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserGroupID_intComboBox);
                    dr[HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.StartDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageRecipientEntity.StartDate_nvc, TypeCode.String);
                    dr[HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.EndDate_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageRecipientEntity.EndDate_nvc, TypeCode.String);
                    dr[HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.Date_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageRecipientEntity.Date_nvc, TypeCode.String);
                    dr[HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.Time_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageRecipientEntity.Time_nvc, TypeCode.String);
                    dr[HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.UserName_nvc.ToString()]  = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageRecipientEntity.UserName_nvc, TypeCode.String);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                MessageRecipientFactory.RollBackProc();
                throw ex;
            }
        }
Esempio n. 8
0
        protected override void Edit()
        {
            HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TFactory MessageRecipientFactory = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TFactory();
            try
            {
                HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T MessageRecipientEntity = new HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T();
                MessageRecipientEntity.MessageID_bint  = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(MessageID_bintComboBox.SelectedValue, TypeCode.Int64);
                MessageRecipientEntity.UserGroupID_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(UserGroupID_intComboBox.SelectedValue, TypeCode.Int32);
                MessageRecipientEntity.Date_nvc        = MessageRecipientFactory.ServerJalaliDate;
                MessageRecipientEntity.Time_nvc        = MessageRecipientFactory.ServerTime;

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    MessageRecipientFactory.BeginProc();
                    MessageRecipientFactory.Update(MessageRecipientEntity, (HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys)Key);
                    MessageRecipientFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.MessageRecipientID_int.ToString() + "='" + ((HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_TKeys)Key).MessageRecipientID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0]["MessageID_bintMessageTitle_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(MessageID_bintComboBox);
                            dr[0]["UserGroupID_intUserGroup_nvc"]   = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserGroupID_intComboBox);
                            dr[0][HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.Date_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageRecipientEntity.Date_nvc, TypeCode.String);
                            dr[0][HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T.MessageRecipient_TField.Time_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(MessageRecipientEntity.Time_nvc, TypeCode.String);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageRecipientFactory.RollBackProc();
                throw ex;
            }
        }
Esempio n. 9
0
        public void Insert(HPS.BLL.MessageRecipientBLL.BLLMessageRecipient_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_MessageRecipient_T_Add]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter MessageRecipientID_int = new SqlParameter();
                MessageRecipientID_int.ParameterName = "@MessageRecipientID_int";
                MessageRecipientID_int.SqlDbType     = SqlDbType.Int;
                MessageRecipientID_int.Direction     = ParameterDirection.Output;
                MessageRecipientID_int.IsNullable    = false;
                MessageRecipientID_int.Value         = businessObject.MessageRecipientID_int;
                this.Command.Parameters.Add(MessageRecipientID_int);

                SqlParameter MessageID_bint = new SqlParameter();
                MessageID_bint.ParameterName = "@MessageID_bint";
                MessageID_bint.SqlDbType     = SqlDbType.BigInt;
                MessageID_bint.Direction     = ParameterDirection.Input;
                MessageID_bint.IsNullable    = false;
                MessageID_bint.Value         = businessObject.MessageID_bint;
                this.Command.Parameters.Add(MessageID_bint);

                SqlParameter UserGroupID_int = new SqlParameter();
                UserGroupID_int.ParameterName = "@UserGroupID_int";
                UserGroupID_int.SqlDbType     = SqlDbType.Int;
                UserGroupID_int.Direction     = ParameterDirection.Input;
                UserGroupID_int.IsNullable    = false;
                UserGroupID_int.Value         = businessObject.UserGroupID_int;
                this.Command.Parameters.Add(UserGroupID_int);

                SqlParameter StartDate_nvc = new SqlParameter();
                StartDate_nvc.ParameterName = "@StartDate_nvc";
                StartDate_nvc.SqlDbType     = SqlDbType.NVarChar;
                StartDate_nvc.Direction     = ParameterDirection.Input;
                StartDate_nvc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.StartDate_nvc))
                {
                    StartDate_nvc.Value = DBNull.Value;
                }
                else
                {
                    StartDate_nvc.Value = businessObject.StartDate_nvc;
                }
                this.Command.Parameters.Add(StartDate_nvc);

                SqlParameter EndDate_nvc = new SqlParameter();
                EndDate_nvc.ParameterName = "@EndDate_nvc";
                EndDate_nvc.SqlDbType     = SqlDbType.NVarChar;
                EndDate_nvc.Direction     = ParameterDirection.Input;
                EndDate_nvc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.EndDate_nvc))
                {
                    EndDate_nvc.Value = DBNull.Value;
                }
                else
                {
                    EndDate_nvc.Value = businessObject.EndDate_nvc;
                }
                this.Command.Parameters.Add(EndDate_nvc);

                SqlParameter Date_nvc = new SqlParameter();
                Date_nvc.ParameterName = "@Date_nvc";
                Date_nvc.SqlDbType     = SqlDbType.NVarChar;
                Date_nvc.Direction     = ParameterDirection.Input;
                Date_nvc.IsNullable    = false;
                Date_nvc.Value         = businessObject.Date_nvc;
                this.Command.Parameters.Add(Date_nvc);

                SqlParameter Time_nvc = new SqlParameter();
                Time_nvc.ParameterName = "@Time_nvc";
                Time_nvc.SqlDbType     = SqlDbType.NVarChar;
                Time_nvc.Direction     = ParameterDirection.Input;
                Time_nvc.IsNullable    = false;
                Time_nvc.Value         = businessObject.Time_nvc;
                this.Command.Parameters.Add(Time_nvc);

                SqlParameter UserName_nvc = new SqlParameter();
                UserName_nvc.ParameterName = "@UserName_nvc";
                UserName_nvc.SqlDbType     = SqlDbType.NVarChar;
                UserName_nvc.Direction     = ParameterDirection.Input;
                UserName_nvc.IsNullable    = true;
                UserName_nvc.Value         = businessObject.UserName_nvc;

                this.Command.Parameters.Add(UserName_nvc);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                this.Command.ExecuteNonQuery();

                businessObject.MessageRecipientID_int = (Int32?)(this.Command.Parameters["@MessageRecipientID_int"].Value);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }