Пример #1
0
        public void Update(HPS.BLL.UserBLL.BLLUser_T businessObject, HPS.BLL.UserBLL.BLLUser_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.UserName_nvc == businessObjectKey.UserName_nvc)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueUserName_nvc") == 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);
            }
        }
Пример #2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.UserBLL.BLLUser_TFactory UserFactory = new HPS.BLL.UserBLL.BLLUser_TFactory();

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


                HPS.BLL.UserBLL.BLLUser_TFactory User_TFactory = new HPS.BLL.UserBLL.BLLUser_TFactory();
                HPS.BLL.UserBLL.BLLUser_TKeys    UserKey       = new HPS.BLL.UserBLL.BLLUser_TKeys();

                UserKey.UserName_nvc = (String)UserGridView.CurrentRow.Cells["colUserName_nvc"].Value;
                UserFactory.Delete(UserKey);

                DataRow[] dr = ((DataTable)this.UserGridView.DataSource).Select(HPS.BLL.UserBLL.BLLUser_T.User_TField.UserName_nvc.ToString() + "='" + UserKey.UserName_nvc.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.UserGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Пример #3
0
 private void UserName_nvcTextBox_Leave(object sender, EventArgs e)
 {
     try
     {
         UserName_nvcTextBox.Text = UserName_nvcTextBox.Text.Replace("ی", "ي").Replace("ک", "ك");
         if (YearComboBox.SelectedValue != null)
         {
             BLL.UserBLL.BLLUser_TFactory UserFactory = new HPS.BLL.UserBLL.BLLUser_TFactory();
             BLL.UserBLL.BLLUser_TKeys    UserKey     = new HPS.BLL.UserBLL.BLLUser_TKeys();
             UserKey.UserName_nvc = this.UserName_nvcTextBox.Text;
             BLL.UserBLL.BLLUser_T UserEntity = UserFactory.GetBy(UserKey);
             if (UserEntity != null)
             {
                 if (UserEntity.Picture_img != null)
                 {
                     System.IO.MemoryStream MemoryStream = new System.IO.MemoryStream();
                     MemoryStream.Write(UserEntity.Picture_img, 0, UserEntity.Picture_img.Length - 1);
                     UserPictureBox.Image = System.Drawing.Image.FromStream(MemoryStream);
                 }
             }
             else
             {
                 this.UserPictureBox.Image = Properties.Resources.Login;
             }
         }
     }
     catch (Exception ex)
     { throw ex; }
 }
Пример #4
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.UserBLL.BLLUser_TKeys UserKey = new HPS.BLL.UserBLL.BLLUser_TKeys();
            UserKey.UserName_nvc = (String)this.UserGridView.CurrentRow.Cells["colUserName_nvc"].Value;
            UserEntityForm User = new UserEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.UserGridView.DataSource, UserKey);

            User.ShowDialog();
        }
Пример #5
0
        public HPS.BLL.UserBLL.BLLUser_T SelectByPrimaryKey(HPS.BLL.UserBLL.BLLUser_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.UserBLL.BLLUser_T businessObject = new HPS.BLL.UserBLL.BLLUser_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;
            }
        }
Пример #6
0
 public void GetBy(HPS.BLL.UserBLL.BLLUser_TKeys keys, ref System.Data.DataTable dataTable)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataTable);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Пример #7
0
 public HPS.BLL.UserBLL.BLLUser_T GetBy(HPS.BLL.UserBLL.BLLUser_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Пример #8
0
 public void Delete(HPS.BLL.UserBLL.BLLUser_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Пример #9
0
        public void SelectByPrimaryKey(HPS.BLL.UserBLL.BLLUser_TKeys businessObjectKey, ref System.Data.DataTable dataTable)
        {
            bool           ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);
            SqlDataAdapter sqlDataAdapter    = new System.Data.SqlClient.SqlDataAdapter(this.Command);

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

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Пример #10
0
        public void Update(HPS.BLL.UserBLL.BLLUser_T businessObject, HPS.BLL.UserBLL.BLLUser_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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

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

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

                SqlParameter UserGroupID_int = new SqlParameter();
                UserGroupID_int.ParameterName = "@UserGroupID_int";
                UserGroupID_int.SqlDbType     = SqlDbType.Int;
                UserGroupID_int.Direction     = ParameterDirection.Input;
                UserGroupID_int.IsNullable    = true;
                if (businessObject.UserGroupID_int.HasValue == false)
                {
                    UserGroupID_int.Value = DBNull.Value;
                }
                else
                {
                    UserGroupID_int.Value = businessObject.UserGroupID_int;
                }
                this.Command.Parameters.Add(UserGroupID_int);

                SqlParameter Picture_img = new SqlParameter();
                Picture_img.ParameterName = "@Picture_img";
                Picture_img.SqlDbType     = SqlDbType.Image;
                Picture_img.Direction     = ParameterDirection.Input;
                Picture_img.IsNullable    = true;
                if (businessObject.Picture_img == null || businessObject.Picture_img.Length == 0)
                {
                    Picture_img.Value = DBNull.Value;
                }
                else
                {
                    Picture_img.Value = businessObject.Picture_img;
                }
                this.Command.Parameters.Add(Picture_img);

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

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

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

                SqlParameter InfractionGroupID_int = new SqlParameter();
                InfractionGroupID_int.ParameterName = "@InfractionGroupID_int";
                InfractionGroupID_int.SqlDbType     = SqlDbType.Int;
                InfractionGroupID_int.Direction     = ParameterDirection.Input;
                InfractionGroupID_int.IsNullable    = true;
                if (businessObject.InfractionGroupID_int.HasValue == false)
                {
                    InfractionGroupID_int.Value = DBNull.Value;
                }
                else
                {
                    InfractionGroupID_int.Value = businessObject.InfractionGroupID_int;
                }
                this.Command.Parameters.Add(InfractionGroupID_int);


                SqlParameter CompanyID_int = new SqlParameter();
                CompanyID_int.ParameterName = "@CompanyID_int";
                CompanyID_int.SqlDbType     = SqlDbType.Int;
                CompanyID_int.Direction     = ParameterDirection.Input;
                CompanyID_int.IsNullable    = true;
                if (businessObject.CompanyID_int.HasValue == false)
                {
                    CompanyID_int.Value = DBNull.Value;
                }
                else
                {
                    CompanyID_int.Value = businessObject.CompanyID_int;
                }
                this.Command.Parameters.Add(CompanyID_int);


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

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

                //--hp>
                //MultiAccess_bit
                SqlParameter MultiAccess_bit = new SqlParameter();
                MultiAccess_bit.ParameterName = "@MultiAccess_bit";
                MultiAccess_bit.SqlDbType     = SqlDbType.Bit;
                MultiAccess_bit.Direction     = ParameterDirection.Input;
                MultiAccess_bit.IsNullable    = false;
                MultiAccess_bit.Value         = businessObject.MultiAccess_bit;
                this.Command.Parameters.Add(MultiAccess_bit);
                //--<hp


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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Пример #11
0
 public UserEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.UserBLL.BLLUser_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }