Ejemplo n.º 1
0
        protected void UserGridView_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e)
        {
            try
            {
                securityAgent = new CryptoProvider();
                DBAgent       = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]);
                DBAgent.AddParameter("@ParamLoginID", UserGridView.GetRowValues(e.VisibleIndex, "LoginID"));
                DBAgent.AddParameter("@ParamNewPassword", securityAgent.GetTemporaryPassword());
                DBAgent.AddParameter("@ParamIsTempPassword", 1);
                DBAgent.AddParameter("@ParamComment", "Password reset by Admin");
                DBAgent.ExecuteNonQuery("dbo.spUpdatePassword");

                UserGridView.DataBind();
            }
            catch (Exception ex)
            {
                CommonHelpers.writeLogToFile("UserGridView_CustomButtonCallback: UserManagement.aspx", ex.Message);
            }
        }
Ejemplo n.º 2
0
 protected void UserGridView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
 {
     try
     {
         securityAgent = new CryptoProvider();
         DBAgent       = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]);
         DBAgent.AddParameter("@ParamUserName", e.NewValues["UserName"]);
         DBAgent.AddParameter("@ParamFirstName", e.NewValues["FirstName"]);
         DBAgent.AddParameter("@ParamLastName", e.NewValues["LastName"]);
         DBAgent.AddParameter("@ParamPassword", securityAgent.GetTemporaryPassword());
         DBAgent.AddParameter("@ParamModifiedBy", Session["LoginID"]);
         DBAgent.ExecuteNonQuery("dbo.spAddUser");
         e.Cancel = true;
         UserGridView.CancelEdit();
         UserGridView.DataBind();
     }
     catch (Exception ex)
     {
         CommonHelpers.writeLogToFile("UserGridView_RowInserting: UserManagement.aspx", ex.Message);
     }
 }