Ejemplo n.º 1
0
        bool SaveRecord()
        {
            bool IsSave = false;

            BusinessEntities.BE_PasswordChange NewBEObj = new BusinessEntities.BE_PasswordChange();
            NewBEObj.UserID      = GlobalVaribles.UserID;
            NewBEObj.NewPassword = txtNewPassword.Text;
            IsSave = NewDALLObj.SaveRecord(NewBEObj);
            return(IsSave);
        }
Ejemplo n.º 2
0
        public bool SaveRecord(BusinessEntities.BE_PasswordChange NewBEObj)
        {
            bool          IsSave = false;
            SqlConnection Conn   = new SqlConnection(ConnString);
            SqlCommand    cmd    = new SqlCommand();

            try
            {
                string Qry = @"Update Users 
                            set
                            Password='******'where UserID='" + NewBEObj.UserID + "' ";
                if (Conn.State == ConnectionState.Closed)
                {
                    Conn.Open();
                }
                cmd.Connection  = Conn;
                cmd.CommandText = Qry;
                //cmd.Parameters.AddWithValue("@UserID",NewBEObj.UserID);
                //cmd.Parameters.AddWithValue("@NewPassword",NewBEObj.NewPassword);
                IsSave = DataAccess.InserRecord(Qry);
                //int i = cmd.ExecuteNonQuery();
                //if (i != 0)
                //{
                //    IsSave = true;
                //}
                //else
                //{
                //    IsSave = false;
                //}
            }
            catch (Exception ex)
            {
                IsSave = false;
                throw ex;
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                {
                    Conn.Close();
                }
                Conn.Dispose();
                cmd.Dispose();
                Conn.ConnectionString = null;
            }
            return(IsSave);
        }